• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

vb label

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
jackjohnson44
Asked:
jackjohnson44
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
PhilAICommented:
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
 
PhilAICommented:
Glad I could help...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now