|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Formatting Text on a textboxI have a list of commands in an array command_string() that I want to
display in a textbox. I can get them all in one column easily enough like this For i = 0 To command_string.Length - 1 TextBox1.Text += command_string(i) & vbCrLf Next But I want them in two or more collumns. How do I do this? Also, the text when it appears in a column is "selected" text for some reason (like in a word processor). Why is this? Hardy Hardy,
Why don't you use, as you want it in your style, a maskedtextbox, they have made it for that reason Cor Show quoteHide quote "HardySpicer" <gyansor***@gmail.com> wrote in message news:da4fafc3-d8dc-4b13-a78a-2f11b80227bc@x31g2000prc.googlegroups.com... >I have a list of commands in an array command_string() that I want to > display in a textbox. > > I can get them all in one column easily enough like this > > For i = 0 To command_string.Length - 1 > TextBox1.Text += command_string(i) & vbCrLf > Next > > But I want them in two or more collumns. How do I do this? Also, the > text when it appears in a column is "selected" text for some reason > (like in a word processor). Why is this? > > Hardy Cor Ligthert[MVP] wrote in an answer to HardySpicer:
<snip> > Why don't you use, as you want it in your style, a maskedtextbox, they have <snip>> made it for that reason > "HardySpicer" <gyansor***@gmail.com> wrote in message <snip>> >I have a list of commands in an array command_string() that I want to <snip>> > display in a textbox. > > > I can get them all in one column easily enough like this > > > For i = 0 To command_string.Length - 1 > > TextBox1.Text += command_string(i) & vbCrLf > > Next > > > But I want them in two or more collumns. How do I do this? Please, correct me if I'm wrong, but as far as I know the MaskedTextBox doesn't support multi-line formatting. Regards, Branco You are right I misunderstood your question.
But AFAIK there is no multiline multicolumn control standard in Net. As you real want that, then you need a 3th party control If the multiline is less needed, then you can use a datagridview You can set than your data in a generic list and simply databind it to that using the bindingsource. Cor "Branco" <branco.medei***@gmail.com> wrote in message Cor Ligthert[MVP] wrote in an answer to HardySpicer:news:0e9dcb29-0b9d-48b8-b1a6-ab916644e51e@c20g2000prh.googlegroups.com... <snip> > Why don't you use, as you want it in your style, a maskedtextbox, they <snip>> have > made it for that reason > "HardySpicer" <gyansor***@gmail.com> wrote in message <snip>> >I have a list of commands in an array command_string() that I want to <snip>> > display in a textbox. > > > I can get them all in one column easily enough like this > > > For i = 0 To command_string.Length - 1 > > TextBox1.Text += command_string(i) & vbCrLf > > Next > > > But I want them in two or more collumns. How do I do this? Please, correct me if I'm wrong, but as far as I know the MaskedTextBox doesn't support multi-line formatting. Regards, Branco HardySpicer wrote:
> I have a list of commands in an array command_string() that I want to If all strings are somewhat the same size, you could use a Tab (vbTab> display in a textbox. > > I can get them all in one column easily enough like this > > For i = 0 To command_string.Length - 1 > TextBox1.Text += command_string(i) & vbCrLf > Next > > But I want them in two or more collumns. How do I do this? or ControlChars.Tab) to separate the items by column: <example> 'Cols contains the number of columns Dim Cols As Integer = 3 Dim S As New System.Text.StringBuilder For I As Integer = 0 To command_string.Length - 1 S.Append(command_string(i) _ & if (((I+1) Mod Cols) = 0, vbCrLf, vbTab)) Next TextBox1.Text = S.ToString </example> > Also, the Lol, sorry, have no idea, I couldn't reproduce it here. Can you be> text when it appears in a column is "selected" text for some reason > (like in a word processor). Why is this? more specific? HTH. Regards, Branco On Jun 13, 6:54 am, Branco <branco.medei***@gmail.com> wrote:
Show quoteHide quote > HardySpicer wrote: Thanks. The text is highlighted for some reason.> > I have a list of commands in an array command_string() that I want to > > display in a textbox. > > > I can get them all in one column easily enough like this > > > For i = 0 To command_string.Length - 1 > > TextBox1.Text += command_string(i) & vbCrLf > > Next > > > But I want them in two or more collumns. How do I do this? > > If all strings are somewhat the same size, you could use a Tab (vbTab > or ControlChars.Tab) to separate the items by column: > > <example> > 'Cols contains the number of columns > Dim Cols As Integer = 3 > Dim S As New System.Text.StringBuilder > For I As Integer = 0 To command_string.Length - 1 > S.Append(command_string(i) _ > & if (((I+1) Mod Cols) = 0, vbCrLf, vbTab)) > Next > TextBox1.Text = S.ToString > </example> > > > Also, the > > text when it appears in a column is "selected" text for some reason > > (like in a word processor). Why is this? > > Lol, sorry, have no idea, I couldn't reproduce it here. Can you be > more specific? > > HTH. > > Regards, > > Branco Hardy
Enable/Disable windows update
vb.net app not finding application configuration file on Windows 2003 Server Standard Problem with Windows Server 2003 Standard R2 Not as 'explicit' as I thought --- What am I missing A question about a failing regular expression Is this Normal? Error adding a data provider to a datagridview control Pass Variable At Design Time mcisendstring stereo problem Exiting app with a code |
|||||||||||||||||||||||