[Help] Or

Posts 1–8 of 8 · Page 1 of 1
[Help] Or
Hey, I need help again. xD
This is what I need :
For the code to go
[example]
textbox1.text = ("I iz pro")
or
textbox1.text = ("I iz newb")
basically, so it randomly chooses which one.
Thanks.
If/else statements.
Will it be random? Just don't see how your example requires a random event. However, if you are looking to have the "I iz pro" / "I iz Newb" appear in a text box based on a outcome predetermined or other, then yes... If Then Statments, the main fundamentals of VB(.net) is Basic Mathematical logic

If I goto the movies then it rains
I went to the movies
-----------------------------------------
It Rains
i think he is talking about randomizing what pops up in the textbox

Example:

When he loads the form one time it will randomly choose "I am pro" or "I am noob"

If that is what you were looking for just use Case 1, Case 2, Case 3, etc. then randomly select a case.
I find the easiest way to do it is with random numbers. You have two possible outcomes, so make a random number generate either the number 1 or the number 2. Then depending on that random number, assign a certain text to the textbox.

I.e

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

Dim RandomClass As New Random()
Dim i As Integer
i = RandomClass.Next(1, 3) 'this will make 'i' either 1 or 2.'
If i = Val(1) Then
TextBox1.Text = "I iz pro"
Else : TextBox1.Text = "I iz newb"
End If

End Sub[/php]

Hope that's what you were asking for :P
Thank you Jdeezy, you've resolved my problems. Repped + Thanked
ok nextgen close this? questions answered
Quote Originally Posted by /b/oss View Post
ok nextgen close this? questions answered
Stop backseat modding. He'll close it if he wants.
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us