473,756 Members | 6,106 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetUp perBound(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 3625
"mabond" <ma****@discuss ions.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.Ta b & _
"Welt" & ControlChars.Ta b & _
"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****@discuss ions.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.Ta b & _
"Welt" & ControlChars.Ta b & _
"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****@discuss ions.microsoft. com> wrote in message
news:4F******** *************** ***********@mic rosoft.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.GetUp perBound(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
4949
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 not perfectly aware of locks. The transaction hangs for 60 seconds thant stops with an ORA-02949 error. Is there a way to change the default timeout for an "insert into" transaction. What would be the setting in Oracle ?
4
2664
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 the showModalDialog Window, I have even tried having a hidden panel in the calling web site and trying to turn it off from the target web site using...
4
6132
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 actually install the service (MSDE does), but I want it set to Manual, and my app starts and stops it. I can Start and Stop the service, but need it to be Manual, and not Automatic
9
3078
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 System.Threading.ThreadInterruptedException System.Threading.ThreadStateException to see if I could get more information about why the thread stops running but that code is never executed. Any ideas on how I can debug this?
3
1950
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. <textarea name="NameOfTextArea" rows="5" cols="60">some text area</textarea>), as I want to then dynamically read back the controls' values Setting the ID attributes doesn't work, nor does the following:...
8
2266
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 happens. dim filt as string ... build filter string... UserControl.ReportFilter = filt
2
1219
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 are columnar. tia, steve
3
3036
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 MouseHover event. To get a Mousehover I must leave and reenter the control. I'd like to get an event each time the cursor stops moving.
2
1389
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 = document.getElementById("pathStore").getAttribute("value"); player.URL = myURL; alert(player.URL);
0
10028
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9836
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9707
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5139
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3352
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2664
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.