Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VB6 Textbox ~ Alignment Bug?


I create a textbox on a form, set alignment to 'right justified' and run it. I type a few characters then hold down the Ctrl key while pressing and releasing the Shift key. The text immediately becomes left aligned, although the alignment property still shows a right aligned.

Why would I want to do this? Well I am using a textbox overlaid on a FlexGrid for data entry and editing. I am using various Ctrl, Shift & Alt combinations with the cursor keys to move around the grid & copy data between cells in various ways. I spent the afternoon looking for a bug in my code before testing a simple textbox with no code!

Is this a bug or a 'feature'? Has anyone else discovered it? Is there a workaround?

Thanks in advance for any help with this.

Kevin




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
TextBox Alignment Help
I need to get data in text boxes aligned...

----------
----------
----------
-5--7--9--
-5--7--9--
-3--5--7--
This is my input (for those who know guitars its tabs) It works fine until i try to put another input like this to the right of it.

----------
----------
----------
-5--7--9--
-5--7--9--
-3--5--7------------
----------
----------
-5--7--9--
-5--7--9--
-3--5--7--

It ends up like this. Is there anyway to make it like this..

---------- ------------
---------- ------------
---------- ------------
-5--7--9-- -3--3--5---
-5--7--9-- -3--3--5---
-3--5--7-- -1--1--3---

...or am i just screwed with my tab writing program.
PLEASE HELP ME I DONT KNOW WHAT IM DOING.

Textbox Alignment
ITtoolbox Portal for Visual Basic - http://visualbasic.ittoolbox.com/

I have defined a textbox to hold 21 characters (set using QWERTYUIOPASDFGHKLZX - 21 chars).
But the problem I have is when spaces are present in the dislay string. It throws the
aligment out. i.e. its centre aligned in the properties settngs.
e.g. I get:-
QWERTYUIOPQWERTYUIOPQ
OPTION 1 OPTION 2
ASSS CCCV
what I want is
QWERTYUIOPQWERTYUIOPQ
OPTION 1_________OPTION 2
ASSS_________________CCCV
The display data is stored in an Access database and has theformat:
QWERTYUIOPQWERTYUIOPQ
OPTION 1_________OPTION 2
ASSS_________________CCCV
but spaces cause the problem.
They must be an option/solution?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

Middle Textbox Alignment
Can you set the properties in a textbox for middle? I have it set for center currently but would like the text to be centered vertically as well as horizontally. The textbox increases during resize when the user clicks on the maximize button but the text stays centered left to right near the top of the box.

Thanks.

TextBox Alignment Settings
I am developing a control in VB5 Control Creation Edition that involves a textbox. However, I am not able to offer the text Alignment property to the user. It says that the property is read-only. Please help me out. It is most urgent.

Thanks a lot in advance.

NIKHIL.

Rich TextBox Alignment.
Hi,

I have a form with a rich textbox control.

I am trying to align text in the rich textbox with:


VB Code:
Dim a As String * 50Dim b As String * 10Dim c As String * 5 a = "AAAA"b = "BBB"c = "%%%"rtb.Text = a & vbTab & b & vbTab & c a = "WWWW"b = "XXX"c = "F"rtb.Text = rtb.Text & vbCr & a & vbTab & b & vbTab & c a = "QQQQQQQQQQQQQQQQQQQQQQQQQ"b = "TTTTTTTTTT"c = "10101"rtb.Text = rtb.Text & vbCr & a & vbTab & b & vbTab & c


The text is not displayed in column-like fashion.
I've tried to remove the * 50, *10, *5 from the Dim; changing fonts; but I just cannot seem to figure a way out.

Any ideas?

Thanx

Textbox Alignment / Multiline
confused and perplexed i am...

In order to get the textbox alignment property to work correctly u are supposed to set multiline to true...

Quote:




MSDN
The MultiLine property in a Textbox control must be set to True for the Alignment property to work correctly. If the MultiLine property setting of a TextBox control is False, the Alignment property is ignored.





That is all well and good and i have always found that it worked that way... then suddenly a couple of days ago textboxes in started to perform alignment miracles with multiline set to false. They would align just as they were set (like a Label)

I remain skeptical and am sticking with multiline set to true but has anyone got any ideas on why this would occur... is there a combination of property settings that have the effect of enabling the alignment property?

Yours confusedly...

Vertical Alignment In Textbox
Hello everybody,



is it possible to do a bottom alignment on a textbox ? My textbox is higher than a standard textbox. This textbox has standard a top alignment.

does anyone know how to do this ? Or is there a work around ?


Thanks a lot,


Bjorn

HELP ME!! TEXTBOX(alignment Property For VB6)
I've been using the alignment property of the TEXTBOX control because i needed to enter in currency figures. I had to assign it a right-justified value. i never had any problems when i was using NT workstation as my environment. When i transferred to windows 95, the alignment property wasn't working anymore. Why is this so? Is this a VB6 bug. Is there a solution to this problem? I am currently developing a system for a big bank here in tokyo and i need to solve this alignment problem by next week.
please help me. . . . . thanks.

Rich Textbox Alignment
Is there a way to make the alignment of the rich textbox justified? I mean, is it possible to right and left align the rich textbox at the same time? Thank you.

Vertical Alignment In Label Or Textbox
is there a way to vertically align text in a control like ie a label or a textbox ?

TextBox Alignment Does Not Work On Printing
Hello,

I am trying to print a form with a couple of textboxes in it. On the form, the text in the TextBoxes are properly Aligned in the Center of the TextBox.

However on Printing the Text always shows up on the left of the textbox.

Is there any solution to have the text in the textboxes print in the center of the Textbox?

Thanks.

Mark

Textbox Alignment Show Top To Bottom.
hi guys! got another newb prob with the textbox. Whenever i am going to type something in the textbox, it starts from the bottom. And my other textbox, it is multilined and has a scrollbar. But everytime the txtbox is filled with the outputs, its scrollbar remains in the top. well, it should go in the bottom everyitme an output comes out to see what's the latest output. But if im going to scroll it down and received another output again, the scrollbar will go to the top again. So I need to scroll it down again. I hope you understand what I mean. I'm really having a hard time explaining what I want to say. Sorry i'm not really used to speak english. Anyway, can someone help me with this? I would greatly appreciate it.

"Failure is the key to success. So try and try until you succeed!"

Edited by - chubzyko on 6/11/2008 9:23:36 AM

TextBox Alignment Unable To Center
I have a 1-3 text box. In the properties I set the Alignment=2 Centered. I also set the properties Text 000 autho unneccessory just for alignment. I do a textbox= Number, This is fine but the text will shift off center. I did a TextBox.Alignment = 2 in form load to be sure but still get the off center to Right. I also ajusted the textbox width but its still off center. Anyone ?



VB.6 User, Since 2002
Next Generation Lighting Controls
www.jmelectronics-online.com

Edited by - Jremote on 3/8/2005 10:52:10 AM

FYI: Alignment Prop Of Textbox Does Not Work
Hi,
Just came across the following problem: on a win95 machine, the aligment property of the textbox doesn't work.

Problem occurs on Win95 and WinNT 4.0 sp2 or before. Single line txtbox ignores the alignment property. SOllution: set multiline to true, then it does work... (but they forget to tell that there are reasons to use a single line txtbox so it's a kind bull solution IMHO)

Read about it at http://support.microsoft.com/suppor...s/Q195/6/31.ASP

(it's not a bug.. it's by design... yeah right....)


Crazy D :-)
"One ring rules them all"

Alignment Of Text In Textbox On A Activex Control
Hi,
I am new at developing activex controls. I am busy
developing a text control which allows one to set it to
only accept decimal or non-decimal numbers or letters
only and/or set the case.
I don't seem to get the alignment property to work. It
appears in a get statement, but has no let. If I try to
set it in the activex code, i.e. txtText.alignment = 1
it tells me that is a read only property. 
Can anybody please explain, or help?
Thanks, Hans
http://www.goodthingsfree.com/
"Programming is easy! It's getting rid of the bugs that's the problem!"
Hans Meier - Rustenburg - South Africa

email@removed
or
email@removed

Setting Textbox Alignment And Direction Using Api Functions
hello,

i have two question which are parts of the same problem that i have.

1. how can i determine the language of the text inserted to a text box? and not by checking the keyascii of the letters
if there is such a way at all.

2. how can i change the alignment and text direction (RightToLeft) of the textbox using api functions like SendMessage or SetWindowLong? i just dont know the parameters of to pass to the functions to do it.

please help.

thank you

Alignment In A Textbox In ActiveX Control (Can't Assign To A Read Only Property)
Hi,
I am new at developing activex controls. I am busy
developing a text control which allows one to set it to
only accept decimal or non-decimal numbers or letters
only and/or set the case.
I don't seem to get the alignment property to work. It
appears in a get statement, but has no let. If I try to
set it in the activex code, i.e. txtText.alignment = 1
it tells me that is a read only property.
I saw Shandy's post re this i.e.
"How to make Alignment available to User in ActiveX"
She suggested:

Public Property Let Alignment(ByVal nNewAlignment As AlignmentConstants)
    nAlignment = nNewAlignment
    text1.alignment = nAlignment <----------------------- Code Added Here
    PropertyChanged "Alignment"
End Property

But I still get "Can't assign to a read only property" at the ' <-------------Code added Here

Can anybody please explain, or help?
Thanks, Hans

Alignment
Hey everyone,

I am a newby to VB and I am having a problem with my app.
the form is set for a size of 1024 X 768...
In the form I have a webbrowser set at the TOP of the form and it is 1024 X 691

FIRST PROBLEM: Even though I have "align controls to grid" OFF it still snaps the height to 690.969????

SECOND PROBLEM: I also have an image right below the webbrowser and they will NOT line up... It seams as thought there is a border around the webbrowser.

Any Ideas???

-Dave

Alignment
Hey,

Im making a basic 3D car-demo in DirectX8 and I have the car and wheels from seperate .x meshes. Now I want to align the wheels aligned to the car, any ideas?


Code:
D3DXMatrixTranslation matTrans, modCar.tCar(0).X, 0.5, modCar.tCar(0).Z
D3DXMatrixMultiply modDXMesh.tMesh(modCar.tCar(0).meshWheel(0)).matMesh, modDXMesh.tMesh(modCar.tCar(0).meshWheel(0)).matMesh, matTrans
Check the attactments how it is displayed when moving the wheel just to the car origin and i think you see how i would like them fitted into the cut-outs in the car.

Alignment Help!
Hello I am building a program that has 4 other forms load on top of it (floating tool menus) and i need them to load in a certain spot each time. and when a button is clicked switched to a different position. how would i do that? any help is greatly appreciated!

In further depth, lets say the program loads and they are put in a certain spot. But i go to Tools > Align Menus Right and they will all go to the top right. i used to know this and i feel stupid for asking but it has been so long.

Need Alignment Help
ok i have program, Im trying to make its so labor cost /parts cost/total cost all line up to the right

Dim str_customername As String 'Name of customer
Dim num2 As Single 'Hours of Labour
Dim num3 As Single 'Cost of parts and suplies

str_customername = customername
num2 = hours
num3 = cost
a = 35 'hourly labour cost
b = 1.05 'sales tax
c = num2 * (a) 'totals labour cost
d = num3 * (b) 'totals parts cost
picoutput.Print "Customer"; " "; customername
picoutput.Print "Labor Cost"; " "; FormatCurrency$(c) 'Labour cost in dollars
picoutput.Print "Parts Cost"; " "; FormatCurrency$(d) 'parts cost in dollars
picoutput.Print "Total Cost"; " "; FormatCurrency$(d + c) 'total cost of repairs
End Sub

Alignment
i have a flexgrid that has been populated with data from the database. To my observation all the data in columns in the flexgrid are align center.. how do i change the alignment?

UDT Alignment
I'm about to play around with ReadDirectoryChanges which requires a FILE_NOTIFY_INFORMATION type aligned on a DWORD boundary. How does one ensure the alignment?

EDIT: Actually it's just a Buffer whos format is defined by the type, so the problem really is how do I ensure that a Byte Array is aligned on a DWORD boundary? (Don't suppose VB does it anyway does it?)

Rtf Alignment
I have a rtf file that gets populated by 2 combo boxs
Combo1 contains paragraphs that are added to the rtf
Combo2 contains sentences that are added to the end of the paragraph one at a time
This works fine until a paragraph is indented then the sentences do not line up.
The sentences are always put at the very beggining of a line and do not line up like this:

Code:
Paragraph
Sentence
another sentence


How can i make the sentences line up with the paragraph?

What Is With The Alignment?
I'm toggling between two child forms and but when I go to the second form, it moves down for some reason...if I load the second form first and click to the first...the first moves down.

Alignment
hey! i just cannot seem to fix this tried evrything

i am using this statenment for left. right and center alignment

Case "center"
If SOP.scopetxt.SelLength > 0 Then
SOP.scopetxt.SelAlignment = rtfCenter
scopetxt.SetFocus
'End If
ElseIf SOP.summtxt.SelLength > 0 Then.......
same goes for rest of the txtboxes..

Case "left"
If SOP.scopetxt.SelLength > 0 Then
SOP.scopetxt.SelAlignment = rtfleft
scopetxt.SetFocus
'End If
ElseIf SOP.summtxt.SelLength > 0 Then.......
same goes for rest of the txtboxes..


Case "right"
If SOP.scopetxt.SelLength > 0 Then
SOP.scopetxt.SelAlignment = rtfright
scopetxt.SetFocus
'End If
ElseIf SOP.summtxt.SelLength > 0 Then.......
same goes for rest of the txtboxes..

but it just works with either first rtbox or works with all at the same time.....please tell me what am i doing wrong.....
...same happens with paste command if i cut something from 1 box and try to paste it in another it pastes in everybox....

thanks in advance!

Tab Alignment.
Private Sub command1_click()

Dim ABC, DEF, GHI, JKL As String
Dim i As String

ABC = "Have "
DEF = "A "
GHI = "Nice "
JKL = "Day "

i = ABC & DEF & GHI & JKL

MsgBox i

End Sub

When the button is clicked it gives a messageBox saying 'Have a nice day '.
The values within ABC, DEF, GHI, JKL will keep on changing in the application I'm writing.
And the values are automatically written in the Log File which is a notepad file. Even that is done
The problem is, that everytime the process runs, the values changes and the log comes
out in a diferrent tab layout. Its not aligned properly. Each time the process runs, the
values changes, and the output in the notepad comes some in all sorts of different
alignment. Some of the name are 6 characters long, some of them 2 characters long. I wanted
to know whether i can come up with a code which can align the log, each tim eits written
and I don't have to align it. The values within variables should append on the same tab
as previous one. can you help?.... waiting of ryour response. thank you..

Alignment In 95
I'm developing on a win 2000 machine, and in my app I have some of my text boxes right justified as they contain currency. Works correctly on my machine, and works correctly when installed on a 98 machine, but when installed on a 95 machine any justifications I have set are lost.

Why? How can I stop this?

Alignment PLZ HELP!
I am making a tab editor(like drums, not 'Tabs'), but I can't seem to align text.. I need "/" to line up.
Example of Tab: TAB
That's not a bad tab, but there are some out there. You notice the "/"'s line up? is there a type of format?
Here's what I had:
Code:
Data = Form1.txtEdit.Text
Data = Replace(Data, " ", "")
Form1.txtEdit.Text = Data

That gets rid of the spaces, but then it can take the tab out of line. Thats why I need a sub for aligning the "/" text. any ideas?

[EDIT]: The "/" is screwed up on this forum... it should be the character when you press SHIFT + (The key above ENTER)



Edited by - Jonotron on 5/14/2005 12:51:57 PM

Alignment
I wanted to know what is the code for center alignment for data in a range. In VBA code. I did alignment = center and it didn't work. Any help will be appreciated. thanks

MSFlexgrid Alignment
how do i align ALL the grids in a flexgrid?

i tried this code with no difference:

MSFlexGrid1.CellAlignment = flexAlignCenterTop

Vertical Alignment
Hi all, another question - I have a label which is indicating a warning light.

If a flag is false, the backcolour is a dark red, and the caption is an empty field. If the flag is true, the backcolour is bright red and there's a "FIRE" caption. The problem is though that the word "FIRE" appears just under the top of the box, and I'd like it to be in the vertical center of the label as well as the horizontal center. I can't find a way to do that though, can anyone tell me ?

Richard

Text Box Alignment
Hi,

I am using a text box to display data. How can I align the text up so that I get this:

Code:
TEST1 PASS
TEST2 PASS
TEST100 PASS
TEST10000 PASS
and NOT this:

Code:
TEST1 PASS
TEST2 PASS
TEST100 PASS
TEST10002 PASS
Is there a tab spacing I can use??


Thanks,

Blaaboy

Vertical Alignment
Sorry for my newbieishness but is there someway to set the vertical alignment of text in a label, either at runtime or designtime? I want my text right there in the center All I see in the properties page is horizontal alignment.

Thanks in advance

Numeric Alignment
I'm embarassed that I can't figure this out, but here goes . . .

Suppoose that I want to print some numbers (not currency) with the decimal points aligned. Common task, eh?


Code:
A(1) = 3.75
A(2) = 451.25
A(3) = 71.50

If I use ...

Code:
Print #1, Format$(A(I), "000.00")
I get ...

Code:
003.75
451.25
071.50
...with ugly zeroes.

If I use ...

Code:
Print #1, Format$(A(I), "##0.00")
I get ...

Code:
3.75
451.25
71.50
... as the # is "number or nothing", I lose the alignment.

Isn't there some character that specifies "number or space"?

Even if I use Tab() or Spc() to get to a certain column, it will insist upon left alignment as in the second example. I hate to think that I'd have to analyze the number and put in a varying number of spaces.

Am I overlooking something simple? This can't be that difficult to do.

Table Alignment
Hi,

How do you align a table in word. I want to center the table on the page. All I can do right now is center the text, which is not what I want to do.

Alignment In Word
I'm running the following code from Excel to generate a report in Word:


Code:
Sub introletter()
Dim WordApp As Object
Dim WordDoc As Object

Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
Set WordDoc = WordApp.Documents.Add

For Count = 1 To 5
WordApp.Selection.TypeParagraph
Next Count

With WordApp.Selection
.Font.Name = "Arial"
.Font.Bold = True
.ParagraphFormat.Alignment = wdAlignParagraphRight
.TypeText ('text')
.TypeParagraph
.TypeText ('more text')
.TypeParagraph
.TypeText ('more text')
End With

'(rest of code)

End Sub

Everything works fine except that it's not aligning the paragraph to the right hand side. It stays on the left. I need the above paragraph to be on the right and then the remaining paragraphs, later in the code, to be on the left. What's wrong with the above? I've searched several threads in this forum and it looks like this is how people are doing it but it's not working here. Thanks for the help.

Alignment On Labels
Hi, Im having some trouble in aligning vertically (not horizontally) whatever text I introduce in a label box. On textboxes Ive got no such problem.
Is there a way I can align (vertically center) text on a label.

I give you an example pic:

http://pwp.netcabo.pt/0167914002/varios/label.jpg

Thanks!

Help With Better Code Alignment
Hi, all. I just took over a VB6 project from someone else at work. The code is a mess with lots of nested IF-THEN-ELSE statements and all of the loops/functions/subs are extremely long, you have to scroll quite a ways to reach the ends. The IF statements are not aligned properly and I am having a tough time trying to read and understand the code. Is there a feature in VB6 that you can have VB6 automatically line up the statements for you? If not, anyone have suggestions on how I can make this code easier to read? Thanks!

Phil

Print Alignment
how to set the space using the currentX of the Print function, instead of using spacing like this, which is not so nice in term of alignment

this is my code

Code:
Printer.Print "IN: " + Text5.Text + " " + Text7.Text
Printer.Print "OUT: " + Text8.Text + " " + Text9.Text
Printer.Print "FEE: $" + Text11.Text
Printer.Print "TAX: $" + Text12.Text
Printer.Print "TOTAL: $" + Text13.Text
Printer.Print "CASH: $" + Text14.Text
Printer.Print "CHANGE: $" + TxtChange.Text

Can I Have Different Alignment In Different Rows?
Can I set the headings (in MSFlexgrid) bold and other rows regular (not bold)? Also, the title in headings aligned center and other values/data in other rows aligned left?

Text Alignment
how would i align the selected text to the right, middle, and left?

Alignment In Labels
I have an type and it loads its self from a file.

What I want to do is write it to the label but I want to write
Food Eaten When
'Mars Bar' 'Yesterday'

Is there a way to align (put a x spaces in between) them when i do this mylbl.caption = meal.food & " " & meal.when

I know of string() function however that will not work. Fonts have different letter sizes so I can't just say put in x spaces cause it depends on what characters there are in the food eaten.

I don't think i'm being very clear, but I can't say it any other way.

Thanks for any help,
Cyril

Horizontal Alignment
Alright, I know this will be simple, but I have to give up on figuring it out myself.

How do I set the horizontal alignment of a cell in VB? I've tried this:

Cells(rw, c).HorizontalAlignment = "Right"

where rw and c are integers, but VB doesn't like it. It says "Unable to set the HorizontalAlignment property of the Range class."

Popup Alignment Help...
Hi,
I encountered a problem with the following codes...

The end result the popup should not cover the button but the problem now is

I'm using a 3 linked monitor, the 1st monitor has no problem but the 2nd and 3rd monitor always popup on the top right hence covering the right buttons...


Code:
Public Function MenuTrack(lMenuType As MenuType, lPosX As Long, lPosY As Long) As Long
On Error Resume Next
Dim display_hwnd As Long

Dim oRect As RECT

display_hwnd = FindWindow("lightD", UserForm1.caption)

Select Case lMenuType
Case DropDown
TrackMenu = TrackPopupMenu _
(menu_hwnd(1), _
TPM_LEFTALIGN Or TPM_TOPALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, _
lPosX, lPosY, 0, display_hwnd, oRect)
Case PushUp
TrackMenu = TrackPopupMenu _
(menu_hwnd(1), _
TPM_LEFTALIGN Or TPM_BOTTOMALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, _
lPosX, lPosY, 0, display_hwnd, oRect)
Case DropDownRightJustified
TrackMenu = TrackPopupMenu _
(menu_hwnd(1), _
TPM_RIGHTALIGN Or TPM_TOPALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, _
lPosX, lPosY, 0, display_hwnd, oRect)
Case PushUpRightJustified
TrackMenu = TrackPopupMenu _
(menu_hwnd(1), _
TPM_RIGHTALIGN Or TPM_BOTTOMALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, _
lPosX, lPosY, 0, display_hwnd, oRect)
Case Else
'Debug.Print "myMenu.TrackMenu, No Case for menu type: " & lMenuType
TrackMenu = 0
End Select
End Function

Thank You in advance for any help.



Edit by Moderator:
Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.

Thank you.

MsoControlDropdown [alignment]
Posted this a couple of days ago here: http://www.ozgrid.com/forum/viewthre...id=5295&page=1

Since I have not recieved a catagorical reply I thought I would try here.

Anyway I have an addin which will display a list of all unhidden workbooks and their visible sheets.

If you run the addin with screen resolution of 800x600 the dropdown will align itself neatlty below the control. At a higher resolution it will default to right alignment to the control.

Can we force the dropdown to always align below or above the control?

Here is the addin:

Flexgrid Alignment
hi all,

currently i'm using flexgrid to show records from database. i found that if the first character of my records was integer then that records will align to right. but if the first character was char then will align to left.
how can i set the alignment for all the records align to left?
thanks

Alignment In MaskEdBox
Hi,

how can i set up alignment in a MaskEdBox ?

Thanks in advance.

Rgds, Addi-Goldkante

Text Box Alignment
Hi there, I have the following problem. I have some text boxes on a form where I enter currency amounts (subtotals, totals), so I want them aligned to the right. This works perfectly in my development environment, but when I package and distribute the executable, all the text is left aligned instead of right aligned. Am I missing a dll or something? I used the VB Package and Deployment Wizard to create an install.
Thanks for all your help,

Monica

Copyright 2005-08 www.BigResource.com, All rights reserved