Some of my VB.net Codes hope it helpls.

angelo10

Member
Reputation
0
Sample1


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b, c As Integer
Dim x As Random = New Random
Dim out As String

out = "Chart" & vbTab & "Frequency" & vbTab & "Bar Chart" & vbCrLf & vbCrLf
For a = 1 To 15
c = x.Next(1, 10)
out &= a & vbTab & c & vbTab & vbTab
For b = 1 To c
out &= "*"
Next
out &= vbCrLf

Next
txtout.Text = out

End Sub
End Class



Sample 2 the joke Machine


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = " What cease to exist when you say its name? " & " Silence! "

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

RichTextBox1.Text = " What is black and white and red all over? " & " A sunburned penguin!"

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
RichTextBox1.Text = " What is black and white and red all over? " & " A sunburned penguin!"
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
RichTextBox1.Text = " What is black and white and red all over? " & " A sunburned penguin!"
End Sub
End Class


Sample 3 computation of diff. shapes

Public Class Form1

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbShape.SelectedIndexChanged
If cmbShape.Text = "Circle" Then
lblX.Visible = True
lblX.Text = "Radius"
X.Visible = True
btnCompute.Visible = True
lblresult.Visible = True
result.Visible = True
lblY.Visible = False
Y.Visible = False
End If

If cmbShape.Text = "Rectangle" Then
lblX.Visible = True
lblX.Text = "Length"
X.Visible = True
lblY.Visible = True
lblY.Text = "Width"
Y.Visible = True
btnCompute.Visible = True
lblResult.Visible = True
result.Visible = True
End If
If cmbShape.Text = "Square" Then
lblX.Visible = True
lblX.Text = "Side"
X.Visible = True
lblY.Visible = False
Y.Visible = False
btnCompute.Visible = True
lblresult.Visible = True
result.Visible = True
End If
If cmbShape.Text = "Triangle" Then
lblX.Visible = True
lblX.Text = "Base"
X.Visible = True
lblY.Visible = True
lblY.Text = "Height"
Y.Visible = True
btnCompute.Visible = True
lblresult.Visible = True
result.Visible = True
End If
End Sub

Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
If cmbShape.Text = "Circle" Then
result.Text = Convert.ToDouble(X.Text) * Convert.ToDouble(X.Text) * 3.1415
End If
If cmbShape.Text = "Rectangle" Then
result.Text = Convert.ToDouble(X.Text) * Convert.ToDouble(Y.Text)
End If
If cmbShape.Text = "Square" Then
result.Text = Convert.ToDouble(X.Text) * Convert.ToDouble(X.Text)
End If
If cmbShape.Text = "Triangle" Then
result.Text = (Convert.ToDouble(X.Text) * Convert.ToDouble(Y.Text)) / 2
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class
 

angelo10

Member
Reputation
0
Sample1


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b, c As Integer
Dim x As Random = New Random
Dim out As String

out = "Chart" & vbTab & "Frequency" & vbTab & "Bar Chart" & vbCrLf & vbCrLf
For a = 1 To 15
c = x.Next(1, 10)
out &= a & vbTab & c & vbTab & vbTab
For b = 1 To c
out &= "*"
Next
out &= vbCrLf

Next
txtout.Text = out

End Sub
End Class



Sample 2 the joke Machine


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = " What cease to exist when you say its name? " & " Silence! "

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

RichTextBox1.Text = " What is black and white and red all over? " & " A sunburned penguin!"

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
RichTextBox1.Text = " What is black and white and red all over? " & " A sunburned penguin!"
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
RichTextBox1.Text = " What is black and white and red all over? " & " A sunburned penguin!"
End Sub
End Class


Sample 3 computation of diff. shapes

Public Class Form1

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbShape.SelectedIndexChanged
If cmbShape.Text = "Circle" Then
lblX.Visible = True
lblX.Text = "Radius"
X.Visible = True
btnCompute.Visible = True
lblresult.Visible = True
result.Visible = True
lblY.Visible = False
Y.Visible = False
End If

If cmbShape.Text = "Rectangle" Then
lblX.Visible = True
lblX.Text = "Length"
X.Visible = True
lblY.Visible = True
lblY.Text = "Width"
Y.Visible = True
btnCompute.Visible = True
lblResult.Visible = True
result.Visible = True
End If
If cmbShape.Text = "Square" Then
lblX.Visible = True
lblX.Text = "Side"
X.Visible = True
lblY.Visible = False
Y.Visible = False
btnCompute.Visible = True
lblresult.Visible = True
result.Visible = True
End If
If cmbShape.Text = "Triangle" Then
lblX.Visible = True
lblX.Text = "Base"
X.Visible = True
lblY.Visible = True
lblY.Text = "Height"
Y.Visible = True
btnCompute.Visible = True
lblresult.Visible = True
result.Visible = True
End If
End Sub

Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
If cmbShape.Text = "Circle" Then
result.Text = Convert.ToDouble(X.Text) * Convert.ToDouble(X.Text) * 3.1415
End If
If cmbShape.Text = "Rectangle" Then
result.Text = Convert.ToDouble(X.Text) * Convert.ToDouble(Y.Text)
End If
If cmbShape.Text = "Square" Then
result.Text = Convert.ToDouble(X.Text) * Convert.ToDouble(X.Text)
End If
If cmbShape.Text = "Triangle" Then
result.Text = (Convert.ToDouble(X.Text) * Convert.ToDouble(Y.Text)) / 2
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class
 

420

Member
Reputation
0
Please use the
Code:
 tags and this is the wrong section. And give us more details about this code, not all people here know VB.NET so they will need a description.

Here is the VB.NET secton:
http://marketswag.net/forumdisplay.php?fid=121