Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

changing VB textbox's tabwidth

Posted on 2003-02-20
2
Medium Priority
?
330 Views
Last Modified: 2008-02-01
hi all,

in VB, by default, the tab width is 8 characters.  how can i change that to 4 characters?

please advice.

Thanks
0
Comment
Question by:jchew
2 Comments
 
LVL 1

Accepted Solution

by:
sazhagianambi earned 200 total points
ID: 7986328
Hi,

str=<Assign the String which having Tabs>

Replace(str, vbTab, "    ")


This Command Replace the Tab Space as 4 BlankSpace.

Regards,
Nambi.
0
 

Author Comment

by:jchew
ID: 7991194
hi Nambi,

your answer is not exactly what i wanted... then after scanning EE further, found the solution at
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20230663.html


manage to adapt that solution to mine, so i added the following codes :

Private Declare Function SendMessageArray Lib "user32" Alias "SendMessageA" _
       (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const EM_SETTABSTOPS = &HCB


' Set new tab stops (in dialog units)
' Note: Default tabs stops are every 32 dialog units
Sub SetTabStops(txtb As TextBox)
Const cMAX = 20
Const cSIZE = 16

   If txtb Is Nothing Then Exit Sub

   ' Can't seem to pass the ParamArray to SendMessage, so copy it to array of long
   ReDim a(cMAX) As Long

   Dim t As Long
   Dim tabcount As Long
   tabcount = cMAX + 1

   For t = 0 To cMAX
       a(t) = (t) * cSIZE
   Next

   'Clear any existing tabs.
   Call SendMessageArray(txtb.hWnd, EM_SETTABSTOPS, 0&, 0&)
   
   'Set the tabs.
   Call SendMessageArray(txtb.hWnd, EM_SETTABSTOPS, tabcount, a(0))

End Sub




since i can't award the points to nazdor (the original poster) and i also can't award the points to myself :)

so i'll award them to you.

thanks for your effort.

regards
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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

578 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