[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb label

Posted on 2006-05-15
3
Medium Priority
?
193 Views
Last Modified: 2010-05-01
Hi,

I have a text box that I use to gather data that goes into a database.

My program then displays that data in a label.

If I put a tab in the text box, when it displays in the label, it looks like a thick black line, kind of like the width of 2 or 3 lower case "L" s.

Is there any way around this?

Thanks
0
Comment
Question by:jackjohnson44
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 800 total points
ID: 16682277
you have to replace the vbTab character by something else ( replace ( yourstring, vbtab, " ") ) , or use some other control (like richtextbox or textbox) instead of the label.
note that you can LOCK the contents of the textbox, so the user can select, but not change the contents...
0
 
LVL 6

Assisted Solution

by:PhilAI
PhilAI earned 1200 total points
ID: 16682332
Set the MultiLine property to True

This will allow the box to accept Tabs
-or-
You can replace it as mentioned by angelIII

If you want the user to be able to type Tabs, then you will need to set all the TabStop properties to False when getting focus on that TextBox; e.g.

Private Sub TextBox1_GotFocus()
Call TabStops_Toggle(Me, False)
End Sub

Private Sub TextBox1_LostFocus()
Call TabStops_Toggle(Me, True)
End Sub

Public Sub TabStops_Toggle(frmObject As Form, bEnabled As Boolean)
'-----------------------------------------------------------------------
' Description : Toggle the TabStop Property within frmObject
'-----------------------------------------------------------------------

Dim C As Long
Static bTabStops() As Boolean

On Error Resume Next

ReDim Preserve bTabStops(0 To frmObject.Controls.Count - 1) As Boolean

For C = 0 To frmObject.Controls.Count - 1
    With frmObject.Controls(C)
        If Not bEnabled Then
            bTabStops(C) = .TabStop
            .TabStop = False
        Else
            .TabStop = bTabStops(C)
            bTabStops(C) = False
        End If
    End With
Next C

End Sub
0
 
LVL 6

Expert Comment

by:PhilAI
ID: 16684350
Glad I could help...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question