English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I've just started with VB programming as I'm an absolute beginner to programming but I got grade A in I.T. so that doesn't mean I'm dumb lol. Anyway, on to the question - I'm currently creating an application (Windows form) in VB 9/2008 Express and I've encountered a problem with this code:

Top = Int(Rnd() * Screen.Height)
Left = Int(Rnd() * Screen.Width)

I'm using that with a Timer and an interval of 100 - in the errors section it says the same for Width and Height:

"Height is not a member of System.Windows.Forms.Screen"
"Width is not a member of System.Windows.Forms.Screen".

I don't know if I've given enough information to resolve the issue as I'm only a beginner (everything has a beginning) at programming but I'm sure I'll add more info to the 'Additional Details'. So, that's my question :P.

2007-12-03 09:50:29 · 1 answers · asked by MeDdErS 3 in Computers & Internet Programming & Design

Doesn't matter I fixed it now.

2007-12-03 11:04:38 · update #1

1 answers

I haven't tried vb2008 but in vb2005 you would use the My object to access the computers screen size.

Below I capture the screen height and assign it into an integer variable. You can then randomize it with additional code on another line.

myInt = My.Computer.Screen.Bounds.Height

2007-12-03 11:26:52 · answer #1 · answered by MarkG 7 · 0 0

fedest.com, questions and answers