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




Align Text In MsFlexGrid


Hi,

i have a problem with flesgrid here:

After loading the data into the flexgrid. i realised that some of the data in the cells are either aligned to the left or right.How can i standardise the alignment of the text in every cells?

Apart from the above, i would also like to know whether can i add rows (flexgrid) using codes rather than specifying in the property? I'll be better if a sample code can be provided.

Thanks a million,friends!

Regards!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MSFlexgrid Text Align In Fixed Row - > Can It Be Changed?
can i chnge the text align of the MsFlexGrid Fixed row using API?

Thanks in advanced!

MSFlexGrid Not Align?
I have the printing function of the MSFlexGrid where it is set to print the MSFlexGrid however when it prints... the first row is align to the left while from the second row it goes to the right? Whats the problem to it?

I have been to forum thread about the MSFlexGrid.. does the only solution for me is to use the autoresizing? No other solutions?

Msflexgrid Align
I have a msflexgrid and it pulls into it data that may be a string or an integer. Now when it fills the grid it aligns the strings on the left and the int's on the right. Is there a way to align everything to the left.
I've tried:

frm_LOOKUP.MSFlexGrid1.CellAlignment = flexAlignLeftCenter
and
Lset

Lset somewhat works but I have to create some huge blank string and then use Lset with my data. So LSet may be the key but I'm just not sure how its working.

Thanks

MSFlexGrid Align Left
Hi all
At the moment I use the following code to align all my data to the left of each cell (so to speak) after I have populated the FlexGrid:


Code:
Dim i As Integer
Dim j As Integer


For i = 0 To opschecklist.MSFlexGrid1.Rows - 1
opschecklist.MSFlexGrid1.Row = i
For j = 0 To opschecklist.MSFlexGrid1.cols - 1
opschecklist.MSFlexGrid1.Col = j
opschecklist.MSFlexGrid1.CellAlignment = flexAlignLeftCenter
Next j
Next i
Is there a quicker way of doing this, as this way is slow and unsightly?
Thanks
Lee123

Vertical Align Text In Text Box / Label Control
I searched on "vertical align" in all forums and did not find this mentioned. (Not that it hasn't been, I just didn't get a hit.)

Anyway, is there a way to vertically align text within a VB 6.0 textbox or label control? (i.e., some programmatic equivalent to the Alignment property) It looks really goofy when the text is crammed against the top of the control ...

Getting some other toolset is not an option. (I am doing this at home for kicks and grins.)

Thanx,

P

Text Align When Outputting To Text File
I have three variables here: item number, description, and price. Each line can be a maximum of 50 characters. I need the first two variables left aligned and the last one right aligned on the same line when outputting to a text file, so it looks like:


Code:
01234567890123456789012345678901234567890123456789
itemno description, color price


I already wrote functions for right alignment but I cannot figure out how to have two different alignments when outputting to the text file on the same line. Anyone have any ideas? Thanks.

Word Text Boxes Align Text?
Is there a way of aligning text to bottom in a text box like you can in the cell of a table?

 

Align In Text Box
hi i have an external file named myfile.txt w/c was properly aligned in two columns now wen extracted try to display iton a textbox the texts were not aligned anymore, i used this code

module:

Public Function Combine(txt As TextBox, Sfile As String)
Dim stxt As String
X = FreeFile
Open App.Path & Sfile For Input As X
txt = StrConv(InputB(LOF(1), 1), vbUnicode)
Close #X
End Function

Text Align API... Help
I am printing text in Picturebox, Unfortunately VB doesn't include text alignment except for label or textbox. But there's API function that can get print text alignment in picture box. Check it out

http://builder.com.com/5100-6228-5421501.html

I added.. Declare Sub SetTextAlign Lib "gdi32" (ByValhDC As Long, ByValwFlags As Long) At very top (Where Option Explicit are) and I get complie error... So I am not sure how to implement it since I am not very familar with API calls, So help me.

Code written already on my form, where do I implement Text Align API function in my form?

Code:
Option Explicit

Private Sub Form_Load()
Picture1.FontBold = True
Picture1.FontSize = 12
Picture1.FontName = "Arial"
Picture1.ForeColor = VbWhite
Picture1.BackColor = vbBlacK

End Sub

Align Text Vertically ?
In any label.caption or txt.text
There is option in Properties windows to align text Horizantly (left , Center,Right) But
But there is no Option seen to Align text Verticaly (Top,Mid,Botom).
If there is no available then how can I do this ?

Align Text To TextBox
I have a form that has one line of text and a textbox. I would like to align the text to the left of the textbox, and centered vertically to the textbox. Is there a way to do this without typing in coordinates or turning off the snap-to-grid and moving it manually? Or, am I just missing the fact that you can do labels for the textbox itself...and all this is taken care of automatically? Thanks in advance!

Toolbar Text Align Help
hi,

Can someone help me or give some info on how to set the Text alignment on the button to the left in a Toolbar, all I can see is tbrTextAlignBottom and tbrTextAlignRight

using the tbrTextAlignBottom is just totaly usless cos there is like a large gap, and if I use the tbrTextAlignRight it just looks even wose and just makes the buttons looks unnatural as the text is closer to the next button.

is there any API call I can use. or anything else.

How To Align Text In A List Box
hello everyone, below is a screen shot of my program.



The text in the list box is read from a text file when the refresh button is clicked.

What i wish to do is align the text so that it comes under the headings like this: (i edited it in paint to give you gys a visual representation :P)



i have attached the whole vb program so you gys can have a look.

Thank you

Using Space() To Align Text
Is it possible to use Space() to get text to left align with headings? Here is what I'm doing now and the result is shown in the attached file.

VB Code:
strMsg = strMsg & "TAG" & Space(11) & "VARIABLE" & Space(11) & "STATUS" & Space(11) _    & "VALUE" & Space(11) & "UNITS" & Space(11) & "TIME" & vbCrLfstrMsg = strMsg & "27-QAO49D" & Space(11) & "PD Pull Roll" & Space(11) & " " & _    Space(11) & "BREAK SHEET" & Space(11) & " " & Space(11) & "15-Sep-05 12:00:00"

Align Text Verticaly ?
In any label.caption or txt.text
There is option in Properties windows to align text Horizantly(left , Center,Right) But
But there is no Option seen to Align text Verticaly(Top,Mid,Botom).
If there is no available then how can I do this ?

Align Text In A ListBox
Is there an easy way right align text in a listbox? I'm currently using tabs to set the colums, but the columns are left aligned and i need my last colum (Numbers) to line up by decimal. is this possibal?

Thanks,

nathan

To Align The Text Box With The Form.......
Hi everybody,

I have created a notepad application. My problem is whenever i maximize the form the text box on the form does not maximize properly or does not fit to the size of the form. I used the resize event of the form. I assigned the height and the width of the form to the height and width of the textbox. But the scrollbars are not adjusted properly. I want that it should maximize properly or fit to the size of the form and also the scrollbars of the textbox should be visible clearly.

Regards

Samir

Align Text In A Label
Is it possible to set text in a multiline label to justify? I don't want left, right or center alignment.

Thanks

Align Rich Text
Is it possible to align the text in a richtext box center?

Textbox.text Can't Right Align...anyone Know If
this a know bug in visual basic?

is there a work-around?

Align Text In A Message Box
Hey guys. has anybody else tried this? it doesn't work.
strMessage = ""
for x = 1 to 5
strMessage = strMessage & vbCrLf & strArray(x)
For y = 1 to (70 - Len(strArray(x)))
strmessage = strMessage & " "
Next y
strMessage = strMessage & strArray2(x)
Next x
MsgBox(strMessage)

What is this for? It should take these 2 arrays and make even columns out of them. But it doesn't. The number of characters in the first array aren't always the same width and so the second column is not aligned.

Since I won't know what is going to print in this array, I can't "make" it line up.

Any thoughts?


Thanks
wengang

Align Columns In Text Box
I have a text box in which multiple columns of figures are displayed as they are computed within my application. Each column may have a varying number of digits or letters.

I want each column to begin at the same relative position in the text box so visually I don't end up with uneven columns. The right side of each column doesn't matter. I realize the font may contribute to unevenness depending upon the character so which font would give me the best results? I don't have a problem with the hard copy output since I convert the contents of the text box to a file and use tabs in the printed results.

Is there a simple way to do this? If I could use tabs in the text box, it would solve the problem. I suppose a series of text boxes (1 for each column) would also work but that would really be a pain. Since the data may go for many lines, I need to have scroll bars or maybe a picture box would do, using currentx,y. I appreciate any advice or solution.

 

To Align The Text In Richtextbox
hai guys,

I am using the form named as billing repot. In this form,we have print button to pritn the content of the bill details in the richtext box. my code is working fine,but all the details of the bill is to be printed in overwrited format.My ques tion is how to align the space for print the bill details in the rich textbox.



Code:
Public Sub PrintView(title As String, query As String, n As Integer, column As Variant)
Dim rs1 As New ADODB.Recordset
Dim colwidth(7) As Integer
rs1.Open "select b.billno,b.bdate,c.caddr,b.quantity,b.rate,b.discount,b.netamt from billing b,CREGISTER c where b.clientname=c.clientname", con, adOpenDynamic, adLockReadOnly
Dim col, ss, sp, Line As String
Line = String$(99, "_") + vbCrLf + vbCrLf
colwidth(0) = 15
colwidth(1) = 10
colwidth(2) = 35
colwidth(3) = 20
colwidth(4) = 25
colwidth(5) = 30
colwidth(6) = 40
colwidth(7) = 45
col = Space(36)
sp = Space(15)
ss = Space(37)
Dim rs As New ADODB.Recordset
rs.Open query, con, adOpenDynamic, adLockReadOnly
View = ""
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(5)

frmprintbill.RichTextBox1.Text = rs1("billno")
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(10)
frmprintbill.RichTextBox1.Text = rs1("bdate")
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(15)
frmprintbill.RichTextBox1.Text = rs1("caddr")
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(20)
frmprintbill.RichTextBox1.Text = rs1("quantity")
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(25)
View = View + vbCrLf + vbCrLf + vbCrLf
frmprintbill.RichTextBox1.Text = rs1("rate")
View = View + Space(30)
frmprintbill.RichTextBox1.Text = rs1("discount")
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(35)
frmprintbill.RichTextBox1.Text = rs1("netamt")
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Space(40)
View = View + Space$(5) + title + vbCrLf + vbCrLf
View = View + vbCrLf + vbCrLf + vbCrLf
View = View + Line
Dim j
For j = 0 To n - 1
    If j = 0 Or j = 1 Then
        LSet col = rs(j)
        View = View + sp + col
    Else
        LSet ss = rs(j)
        View = View + sp + ss
    End If
Next j
View = View + vbCrLf
View = View + Line
While Not rs.EOF
'Dim i
    For i = 0 To n - 1
        If i = 0 Or i = 1 Then
            LSet col = rs(i)
            View = View + sp + col
        Else
            ss = Space(colwidth(i))
            LSet ss = rs(i)
            'View = View + sp + ss
            View = View + ss
        End If
    Next i
    View = View + vbCrLf
    rs.MoveNext
Wend
frmprintbill.Show
End Sub
[code]

Plzzzz trace the code and swend the solution for me.


bye
ram

How To Align Text In RichTextBox
Can anybody help me?

I want to print the text from the richtextbox in the format aligned by the user. How shall i go for it?

Thanks

Vertically Align Label Text
This is probably a really silly question, but is it possible to vertically centre text displayed in a label?
Any help greatly appreciated

How To Align Text In A Flexgrid Cell??
Could anyone plz tell me how to center your text within a cell
in a flexgrid??
I have to do this for a project for school and I can't find it
Please help me out

Align Text To Right Side In Textbox?
hi

I have a textbox (Text1) and have a large amount of text which fills the textbox and beyond.

How do I align this text such that the last character is always aligned to the right of the text box (and is visible)?

cheers

Text Align Property When Unavailable
How can I left-align the caption of a command button? Is there any trick using the API functions?

Align Text Box Array With List Box
I have a list box and wish to be able to enter data to the side of the list box , for each item in the list box
eg
List box                         Text Box
aaaaaaaaaa                       mmmmm
bbbbbbbbbb                       pppppp

I have set the text box up as text1(0)  etc so that i can
create an array beside the list box

Is there any way of getting the depth of the text box = depth of the list box or visa versa.

Or is there any other trick of being able to enter data beside a list box , line by line.

I suppose at a last resort i could put the data to a table and use a data entry box.


Appreciate any help or ideas.


Align Text With Column Headings
Good day

I would like to have code to align the text within the headings. I have the following headings :
Name: Surname: Comments:
The code is printing but the text is not aligned especially the comments column where the text sometimes overlaps to the next line.

Thx in advance



bednarjm - move to vb6 forum




Edited by - bednarjm on 7/16/2008 10:49:43 AM

How Do You Align Header Text In A Datagrid?
Is it possible to align text in the headers of a datagrid?

TIA
Deke

Align Text Within Label Or Text Box
Can someone tell me how to vertically align text within a txt box or a label in visual basic 6.

Left Align Text In Command Button?
Can anyone tell me how to left align a command button caption, I thought it would be an easy thing to do, but I can't figure it out.
I know this seems like a stupid question!

Align Text/formating In Excel Sheet Using VB 6
Hi,

I am having a problem with aligning text while creating an Excel sheet from VB 6, I implemented the late binding concept and hence I cannot use any property/method specific to one lib. I started off by referencing Excel 10.0 object lib in my VB project and used some properties and methods to align text and draw borders. But since I used late binding, I am not able to use the same properties. For example,

objExcelApp.Cells(2, 4).HorizontalAlignment = xlVAlignCenter
objExcelSheet.Range("A111").Borders(xlEdgeRight).Color = vbRed

I am getting an error when I run the project which reads "variable not declared/defined" and is pointing to xlVAlignCenter

Are there any other properties/methods I can use to achieve the same without referencing any object libraries in my project. Any help is appreciated.

Thanks in advance
Praveen

Left Align Text In A Command Button?
Can anyone tell me how to left align a command button caption, I thought it would be an easy thing to do, but I can't figure it out.
I know this seems like a stupid question!

API Question: Picture Box Print Text Align
I am printing text in Picturebox, Unfortunately VB doesn't include text alignment except for label or textbox. But there's API function that can get print text alignment in picture box. Check it out

http://builder.com.com/5100-6228-5421501.html

I added.. Declare Sub SetTextAlign Lib "gdi32" (ByValhDC As Long, ByValwFlags As Long) At very top (Where Option Explicit are) and I get complie error... So I am not sure how to implement it since I am not very familar with API calls, So help me.

Code written already on my form, where do I implement Text Align API function in my form?

VB Code:
Option Explicit Private Sub  Form_Load()Picture1.FontBold = TruePicture1.FontSize = 12Picture1.FontName =  "Arial"Picture1.ForeColor = VbWhitePicture1.BackColor  = vbBlacK End Sub

Align Text On Standard Command Button
I had found this code awhile ago, I think from this site, and I
never used it until now. I am trying to left or right align some text
on a standard command button. I havve searched the forums
extensively and couldn't find a solution on this. Does anyone
have an idea how to do this?

Thanks.


VB Code:
Option Explicit Public Const GWL_STYLE As Long = (-16) 'these are not true Windows button stylesPublic Const BS_ALIGN_CENTRELEFT As Long = &H100Public Const BS_ALIGN_CENTRERIGHT As Long = &H200Public Const BS_ALIGN_CENTRE As Long = &H300Public Const BS_ALIGN_TOPMIDDLE As Long = &H400Public Const BS_ALIGN_TOPLEFT As Long = &H500Public Const BS_ALIGN_TOPRIGHT As Long = &H600Public Const BS_ALIGN_BOTTOMMIDDLE As Long = &H800Public Const BS_ALIGN_BOTTOMLEFT As Long = &H900Public Const BS_ALIGN_BOTTOMRIGHT As Long = &HA00 Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long   Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _ByVal dwNewLong As Long) As Long Public Type ControlLayoutData   totalRows As Long   totalColumns As Long   rowPadding As Long   colPadding As Long   ctlHeight  As Long   ctlWidth As Long   pgridTop As Long   pgridLeft As LongEnd Type Public style As Long

Command Button With Icon And Text??? Align???
I have a command button on a form that should have both a icon and a text. The problem I have is that the icon and the text aligns on the center of the button. I want the icon to the left of text. Can this be done without having to make an image with both the icon and the text???


/Smirre

Center Align Text On VB Print Output
How does one center align text on a print output from VB rather than using X Y coordinates?  This is what I have so far, but I would like the two lines of text to always center no matter what part number prints... tia.  Maureen

iNumCopies = 1
LoadLbl = MsgBox("Large " & Lblinternaldel & " label required for " & Lblrscitemno & ".  Load label stock in Printer.", 1, "AUME Special Label")
        If LoadLbl = 2 Then GoTo errHandler
        CommonDialog1.CancelError = True
        On Error GoTo errHandler
        CommonDialog1.ShowPrinter
        CommonDialog1.FromPage = 1
        CommonDialog1.ToPage = 1
        NumCopies = CommonDialog1.Copies
        For iNumCopies = 1 To NumCopies
            On Error GoTo 0
            Printer.Orientation = 2    '2 = Landscape
            Printer.FontName = "Arial"
????        Printer.CurrentX = 800
????        Printer.CurrentY = 2000
            Printer.FontSize = 150
            Printer.FontBold = True
            Printer.Print Lblcustitemno
????        Printer.CurrentX = 4600
????        Printer.CurrentY = 6000
            Printer.FontSize = 160
            Printer.FontBold = True
            Printer.Print Format(Lblqty, "#####0")
            Printer.EndDoc
        Next iNumCopies

You Can Align Text In A Text Box But Not Rich Text Box????
I dont see a way to centre or align text to the rigth in a rich text box, which such features are there in a normal basic text box.

thats very odd..... Rich text box is ment to be advance with stuff like that no???

or am i missing something here?

can it be done programmicaly maybe?

Abe

Flexgrid Column Width And Text Align Problem
Hi,

i have the flexgrid which is not connected to database.I have set the first row with the captions and second onwards rows contain data according to the caption.I want to set the column width that should fit the content of the row and align the text left justified.

i tried :

flexgrid.CellAlignment = vbAlignLeft
flexgrid1.colwidth(0) = len(data)


if any of the experts know ,please help.

Thanks.

---Solved ---How To Set Text In MS FlexGrid Align To Left Or Right In Column ?
How to set data in MS FlexGrid align to left or right in each column ? Thanks

Text Box In MSflexGrid
As the title says, i want to put a text bopx in a flex grid, when the user clicks on a cell, they will be able to edit the cell they are on instanly.

Thanks

ILMV

Delete Text In MSFlexGrid
I have a button on a form that I want to delete text in flexgrid. I want to be able to select any amount of cells and click the button to delete the text. I'm sure its not .clip because that only deletes one cell and not all of the selected cells. Can anyone tell me how to delete the text in the selected cells? Thanks

MSFlexGrid Text Edit
I am trying to use the code from flyguy in his tutorial. It looks like you need to double click a cell in the MSFlexGrid and txtcell is to move to that cell. This is not happening. What do I need to do to get it working?

Bold Text In MSFlexGrid
Hello All,

I have an MSFlexGrid with several rows. What I cannot seem to get is for the first row, Row 0, to be bold and the other rows to be normal. I either get all or nothing bolded. Code tried:-

MSFlexGrid1.row = 0
MSFlexGrid1.Font.Bold = True

MSFlexGrid1.row = 1
MSFlexGrid1.Font.Bold = False

etc.

Tarablue

Text File To Msflexgrid
i have data in the text file. i want to put the data in msflexgrid in three columns. how to write the code to do that?

MSFlexgrid && Select Text
How can I select the text in a cell of a msflexgrid similarly to the selstart and sellength properties in a textbox?

Aligning Text In A Msflexgrid
the problem is if the record declared to a database is number, the alignment to the text declared is different. can anyone help me so that i can align it the same as number and text?

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