473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Setting tab stops in RTF control

Hi all

I have an rtf control on my form. The control is populated with text from an
string array created as the application runs. The code to populate the rtf
control is as follows

For l = 0 To arrayList.GetUpperBound(0)
If arrayList(l, 0) Is Nothing Then
'do nothing
Else
output &= arrayList(l, 0) & vbTab & vbTab _
& arrayList(l, 1) & vbTab _
& arrayList(l, 2) & vbTab _
& arrayList(l, 3) & vbCrLf
End If
Next

RichTextBoxList.Text = output
My problem is that the 4 columns do not line up neatly in this method as the
strings in any element of the array may be longer (or shorter) than that in
the next element of the array. In some case the first index of the array
element will be longer than where the first tab would normally go in the
control and the next will be shorter. So the two columns are not lined up. I
need to be able to adjust, programatically, the gap between the tab stops in
the rtf control.

Is that possible or is there another solution

Thanks and regards

Michael Bond

May 22 '06 #1
3 3604
"mabond" <ma****@discussions.microsoft.com> schrieb:
My problem is that the 4 columns do not line up neatly in this method as
the
strings in any element of the array may be longer (or shorter) than that
in
the next element of the array. In some case the first index of the array
element will be longer than where the first tab would normally go in the
control and the next will be shorter. So the two columns are not lined up.
I
need to be able to adjust, programatically, the gap between the tab stops
in
the rtf control.


\\\
Private Sub Form1_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Load
Me.RichTextBox1.Text = _
"Hallo" & ControlChars.Tab & _
"Welt" & ControlChars.Tab & _
"Bla"
End Sub

Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
Me.RichTextBox1.SelectAll()
Me.RichTextBox1.SelectionTabs() = _
New Integer() {100, 200, 300}
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 22 '06 #2
Herfried

Much obliged. Perfect solution

Thanks

Michael Bond

"Herfried K. Wagner [MVP]" wrote:
"mabond" <ma****@discussions.microsoft.com> schrieb:
My problem is that the 4 columns do not line up neatly in this method as
the
strings in any element of the array may be longer (or shorter) than that
in
the next element of the array. In some case the first index of the array
element will be longer than where the first tab would normally go in the
control and the next will be shorter. So the two columns are not lined up.
I
need to be able to adjust, programatically, the gap between the tab stops
in
the rtf control.


\\\
Private Sub Form1_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Load
Me.RichTextBox1.Text = _
"Hallo" & ControlChars.Tab & _
"Welt" & ControlChars.Tab & _
"Bla"
End Sub

Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
Me.RichTextBox1.SelectAll()
Me.RichTextBox1.SelectionTabs() = _
New Integer() {100, 200, 300}
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 22 '06 #3

"mabond" <ma****@discussions.microsoft.com> wrote in message
news:4F**********************************@microsof t.com...
Hi all

I have an rtf control on my form. The control is populated with text from
an
string array created as the application runs. The code to populate the rtf
control is as follows

For l = 0 To arrayList.GetUpperBound(0)
If arrayList(l, 0) Is Nothing Then
'do nothing
Else
output &= arrayList(l, 0) & vbTab & vbTab _
& arrayList(l, 1) & vbTab _
& arrayList(l, 2) & vbTab _
& arrayList(l, 3) & vbCrLf
End If
Next

RichTextBoxList.Text = output
My problem is that the 4 columns do not line up neatly in this method as
the
strings in any element of the array may be longer (or shorter) than that
in
the next element of the array. In some case the first index of the array
element will be longer than where the first tab would normally go in the
control and the next will be shorter. So the two columns are not lined up.
I
need to be able to adjust, programatically, the gap between the tab stops
in
the rtf control.

Is that possible or is there another solution

Thanks and regards

Michael Bond


I've dealt with that problem in the past by using a fixed-fount, such as
"Courier".

When I was dealing with it, the problem was that some fonts are designed
with
different widths for each character to make them more pleasing to the eye.

Ross
May 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andras Kovacs | last post by:
I have a "insert into" transaction that hangs because there is a lock on the table and one of its rows. (Advanced syncron replication causes this locking problem.) Unfortunately adv replication is...
4
by: Jim Mitchell | last post by:
I have a web page that I show using show ModalDialog. The web page takes about 6 seconds to load. No matter what I try, I can not get the cursor to show a "WAIT" until the page is loaded in...
4
by: Paul Aspinall | last post by:
Hi I have a service installed, but I want to programatically set it to 'Manual' startup, rather than 'Automatic'. I cannot do this with 'System.serviceProcess.ServiceInstaller()' as I don't...
9
by: mareal | last post by:
I have noticed how the thread I created just stops running. I have added several exceptions to the thread System.Threading.SynchronizationLockException System.Threading.ThreadAbortException...
3
by: Patrick | last post by:
I am dynamically creating TextArea and drop-down lists in ASP.NET using something like HtmlTextArea eachTextArea = new HtmlTextArea(); I tried to set the "name" of these TextAreas, etc. (e.g....
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
2
by: steve | last post by:
anyone have an idea of how to set tab stops for nodes in a treeview control. i'd like to display a string of tab delimited data in the tree nodes so the nodes at the same level appear as if they...
3
by: Just Me | last post by:
If I move the mouse cursor over a control and stop moving I get a MouseHover event. If I then move the cursor while staying within the control and then stop moving I do not get another...
2
by: gsauns | last post by:
I have a Windows Media Player control embedded in my page. This is the code I use to get it to play: function setPlayerURL() { player = document.getElementById("wmpWindow"); myURL =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.