Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Visual Basic Problem...

Author
Message
Daris Xiao or Benjy Wright
20
Years of Service
User Offline
Joined: 13th Dec 2003
Location: Face first in a bowl of soup.
Posted: 16th Dec 2003 17:39
I'm sorry if this isn't supposed to be posted here, but I can't get any help anywhere else.

I'm trying to make the program pick three random numbers and paste them onto labels.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = (Int(Rnd(10) + 1))
Label2.Text = (Int(Rnd(10) + 1))
Label3.Text = (Int(Rnd(10) + 1))
End Sub

If anyone can help, please do.

I am DarisX. Not MegaManX.
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 16th Dec 2003 17:42
label1.caption instead of label1.text

Watch this space if you like getting bored...
http://darkbasicpro.thegamecreators.com/?gf=irc <<Visit the chat!.;
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th Dec 2003 17:42
if you have option strict on, which you should you need to wrap the (Int(Rnd(10) + 1)) in a cstr() or use Int(Rnd(10) + 1).tostring

let me go double check this.... brb

-RUST-

VB.NET makes me all goose-pimply!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th Dec 2003 17:46 Edited at: 16th Dec 2003 17:48
he is using .net, it is .TEXT property, no caption property exists

here is a random number function I had...

you need to convert number to string to use in a label text property
you can either modify the function to return string and use it, or convert after the return, incase you want to maintain the numeric value in code as well as display the string

-RUST-

VB.NET makes me all goose-pimply!
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 16th Dec 2003 18:02
my bad

Watch this space if you like getting bored...
http://darkbasicpro.thegamecreators.com/?gf=irc <<Visit the chat!.;
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th Dec 2003 18:10
np Mnemonix. The

Quote: "Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click"


bit gives it away that it isn't vb6.

good man DarisX!! .NET is the way

-RUST-

VB.NET makes me all goose-pimply!
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 16th Dec 2003 19:37
Quote: "I'm sorry if this isn't supposed to be posted here, but I can't get any help anywhere else..."

Hmmm, OK, there a number of VB users here so it might have been better to have post this in the General Talk forum, that way there is less chance of this thread being locked.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.

Login to post a reply

Server time is: 2024-11-25 20:44:30
Your offset time is: 2024-11-25 20:44:30