View Single Post
  #4 (permalink)  
Old February 4th, 2005, 03:39 PM
ejan ejan is offline
Authorized User
 
Join Date: May 2004
Location: Karachi, Sindh, Pakistan.
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Jimmy,

Here is what's wrong with your code. Frankly nothin' except a spelling mistake!

The control you are trying to add is a Button named "NewButton". You set some of its properties and finally try to add it to the Controls collection of the Form using this line of code:

                Me.Controls.Add(New Button())

Look closely, you should have written it like this:

                Me.Controls.Add(NewButton())

So what's the difference? an EXTRA SPACE between the words "New" and "Button". What this line of code does is create a new Button control and add this newly created button to the controls collection which is then displayed on the form. And none of its properties, such as Text and Size, will be set, of course!

That's the problem. Change the aforementioned line of code to this:

                Me.Controls.Add(NewButton())

and it will work.

Finally, you should have posted this question to the VB.Net forum. Plz take care with such issues coz it helps to keep the forums organized and thus make life easier for us poor mortals.

Hope your problem is solved.

ejan
Reply With Quote