|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using MSDN examplesWhen I use an example from the MSDN Library, say, to programmically create a radio button, all I get is an empty form. What am I missing? Here's the code (I just add under the Windows generated code): Form 1 (Class Name) - InitializeMyRadioButton (Method Name) ------------------------------------------- Private Sub InitializeMyRadioButton() ' Create and initialize a new RadioButton. Dim radioButton1 As New RadioButton() ' Make the radio button control appear as a toggle button. radioButton1.Appearance = Appearance.Button ' Turn off the update of the display on the click of the control. radioButton1.AutoCheck = False ' Add the radio button to the form. Controls.Add(radioButton1) End Sub Hi,
Show quoteHide quote > When I use an example from the MSDN Library, say, to programmically Are you sure your code is also called? just writing a Sub is not enough, you > create a radio button, all I get is an empty form. What am I > missing? Here's the code (I just add under the Windows generated > code): > > Form 1 (Class Name) - InitializeMyRadioButton (Method Name) > ------------------------------------------- > Private Sub InitializeMyRadioButton() > ' Create and initialize a new RadioButton. > Dim radioButton1 As New RadioButton() > > ' Make the radio button control appear as a toggle button. > radioButton1.Appearance = Appearance.Button > > ' Turn off the update of the display on the click of the control. > radioButton1.AutoCheck = False > > ' Add the radio button to the form. > Controls.Add(radioButton1) > End Sub need to call it from Somewhere ... for example here (sorry, german visual studio ...) Public Sub New() MyBase.New() ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. InitializeComponent() InitializeMyRadioButton() End Sub The Sub New is in the "Windows Forms Designer generated code"-area ... Regards, Frank Eller www.frankeller.de
Show quote
Hide quote
"Frank Eller" wrote: Thank you so much! It works now :-) I didn't think I was supposed to fool > Are you sure your code is also called? just writing a Sub is not enough, you > need to call it from Somewhere ... for example here (sorry, german visual > studio ...) > > Public Sub New() > MyBase.New() > > ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. > InitializeComponent() > > InitializeMyRadioButton() > > End Sub > > The Sub New is in the "Windows Forms Designer generated code"-area ... > > Regards, > > Frank Eller > www.frankeller.de around with any code in the "Windows Forms Designer generated code" area. I have so much to learn..... Thank you, again! Show quoteHide quote > > > > LemonSeven wrote:
> Thank you so much! It works now :-) I didn't think I was supposed In general, I think you are best off leaving that whole area alone, but it's> to fool around with any code in the "Windows Forms Designer generated > code" area. I have so much to learn..... Thank you, again! sometimes extremely useful to be able to put code into the constructor of the class (i.e., the Public Sub New() procedure). You could put it into the Form Load event too, but that doesn't execute until the form has actually been displayed on screen, which can sometimes be too late. -- (O) e n o n e
Draw Line of Form?
clear backstyle for lable control? Question about declaritive Role Based security... Opening a file over the internet Hyperlinks Does anyone help me convert vb.net to c# Database filepath got overrided by OpenFiledialog??? formatting Dates? Programmable breakpoints? String With fixed Length |
|||||||||||||||||||||||