?
Solved

changing VB textbox's tabwidth

Posted on 2003-02-20
2
Medium Priority
?
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 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