- Joined
- Dec 29, 2006
- Messages
- 36
Hey guys, if you know visaul basic, it would be great if you can help me out, not how to do it, but help me i guess.
You're suppose to input the numbers for number of blue, red marbles, and either a yes or no and for out come you get a fraction for probability for getting red/blue marbles
Public Class Form1
Dim
Dim input, replace, event1, event2 As String
Dim howmany, red, blue, numerator1, numerator2, denominator1, denominator2 As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Input = TextBox1.Text
howmany = Input.substring(0, 1)
Input = Input.remove(0, 2)
red = input.substring(0, input.Indexof(","))
input = input.remove(0, input.indexof(",") + 1)
blue = Input.substring(0, Input.indexof(","))
Input = Input.remove(0, Input.indexof(",") + 1)
If howmany = 1 Then
event1 = input
Else
Replace = Input.substring(0, 1)
event1 = input.Substring(0, 1)
event2 = input.Substring(0, 2)
End If
If replace = event1 Then denominator1 = red + blue Else denominator1 = red + blue - 1
If replace = event2 Then denominator2 = red + blue Else denominator2 = red + blue - 1
Label1.Text = input
You're suppose to input the numbers for number of blue, red marbles, and either a yes or no and for out come you get a fraction for probability for getting red/blue marbles
Public Class Form1
Dim
Dim input, replace, event1, event2 As String
Dim howmany, red, blue, numerator1, numerator2, denominator1, denominator2 As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Input = TextBox1.Text
howmany = Input.substring(0, 1)
Input = Input.remove(0, 2)
red = input.substring(0, input.Indexof(","))
input = input.remove(0, input.indexof(",") + 1)
blue = Input.substring(0, Input.indexof(","))
Input = Input.remove(0, Input.indexof(",") + 1)
If howmany = 1 Then
event1 = input
Else
Replace = Input.substring(0, 1)
event1 = input.Substring(0, 1)
event2 = input.Substring(0, 2)
End If
If replace = event1 Then denominator1 = red + blue Else denominator1 = red + blue - 1
If replace = event2 Then denominator2 = red + blue Else denominator2 = red + blue - 1
Label1.Text = input






