0% found this document useful (0 votes)
18 views1 page

Gambas 2

The document contains code snippets that demonstrate different ways to display text or values in labels and textboxes, change form properties like background color, and copy text between controls when buttons are clicked in Visual Basic.

Uploaded by

Alivia Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Gambas 2

The document contains code snippets that demonstrate different ways to display text or values in labels and textboxes, change form properties like background color, and copy text between controls when buttons are clicked in Visual Basic.

Uploaded by

Alivia Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Display a sentence

public Sub Button1_click()


Label1.Caption= " I Like Gambus "
End
-----------------------------------------------------------------
Compute Value of 1500+1000-450*10+300/5

public Sub Button1_Click()


Dim res As Float
res=1500+1000-450*10+300/5
Label2.Caption= " "&res
End
-----------------------------------------------------------------
Using Value of x and y from user.Calculate (X*X*Y)

public Sub Button1_Click()


Dim x,y,res As Float
x=Val(TextBox1.text)
y=Val(TextBox2.text)
res=(x^2 *y)
Label3.Caption="x^2y="&res
End
------------------------------------------------------------------
Form Background /color Change

Public Sub Form Open()


FMain.Background = Color.Cyan
End
-----------------------------------------------------------------
When click on command my name appears

public Sub Button1_click()


Label1.Caption= "Name: Saikat "
End
-----------------------------------------------------------------
Display name and department in two textboxes

public Sub Button1_Click()


Textbox1.text="Saikat"
Textbox2.text="CSE"
End
public Sub Button2_Click()
Textbox1.Clear
Textbox2.Clear
End
public Sub Button3_Click()
Form3.Close()
End
-----------------------------------------------------------------
Copy text from one textbox to another

public Sub Button1_Click()


TextBox2.text=TextBox1.text
TextBox2.Font=Font["28"]
End
-----------------------------------------------------------------

You might also like