You need to set the textbox to "multiline" for you to be able to write multiple lines in it. the multiline property is something you can set at design time in the textbox's properties window.
I am not sure what you mean with your second question "change the name of an optionbutton from the code every time that end a sub". Can you please try to explain a little further?
you are wright i wasn't clear enough.
Everytime that i click an commandbutton I want to change the name of three option buttons, but not manual, I want to do so with the code.
e.g optionbuttonA1 to optionbuttonA2
Drini selmani wrote:
you are wright i wasn't clear enough.
Everytime that i click an commandbutton I want to change the name of three option buttons, but not manual, I want to do so with the code.
e.g optionbuttonA1 to optionbuttonA2
Hi Drini,
Do you mean RadioButtons ( not option buttons ) ?
By the way you could use a RichTEXTbox instead of a textbox as it has a default size of more than one line.
See also my similiar reply in this thread.>>
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1932156&SiteID=1
You do not need to be concerned about the MultiLine property of a textbox if you use a RichTextBox instead.
Use vbCrLf or vbNewLine to start a new line in a TextBox or a RichTextBox.
you can also use
ControlChars.NewLine
or if you put
Imports Microsoft.VisualBasic.ControlChars
at the top of your FORM code you can then use
NewLine
on its own.
E.G.
TextBox1.MultiLine = True
TextBox1.Text = "Line1" & vbCrLf & "Line2"
'or
TextBox1.Text = "Line1" & vbNewLine & "Line2"
'or with the above mentioned IMPORTS statement you can use.>>
TextBox1.Text = "Line1" & NewLine & "Line2"
Regards,
S_DS
Drini selmani wrote:
hello there, I'm a student in Athena and i have two problems with vb. but first i want to thank you in addition.When i am writing a text in textbox.caption i want to change line and i don't know how. "enter" doesn't work.the other thing is that i want to change the name of an optionbutton from the code every time that end a sub.I'm trying for tow days know but still nothing.( Why? from S_DS)Once again thank you
Hi again Drini Selmani,
Tip:
If you want to do two or more things with what " appears to be " one button then put the buttons on top of one another in the designer and then select the control and event from the ComboBoxes at the top of your code window.
See also my post in this thread which mentions 5 ways of starting a NewLine.>>>>
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2023930&SiteID=1
Public
Class Form1'This next highlighted line should be one line of code in your code window.>>>>
Private Sub RadioButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.Click
'How to change the name.
RadioButton1.Name =
"Choice1"'How to change the text.
RadioButton1.Text =
"Option 1"MessageBox.Show(
"You clicked RadioButton1")End Sub
End Class
Regards,
S_DS