Hi guys good day.!

I have two numbers(105 & 210). I want the 105 to be left align in textbox1 and 210 to be right align in the same textbox at form load.

Would this be possible.?

Thank you guys for giving time with this post.!

God bless us all.

Edited 7 Years Ago by blocker: n/a

Not even with an RTB but you could fake it.

Easiest way would be to use a mono spaced font like courier new and add the required number of spaces between the two sets of numbers.

Good Luck

Not even with an RTB but you could fake it.
Easiest way would be to use a mono spaced font like courier new and add the required number of spaces between the two sets of numbers.
Good Luck

Hey that is your problem ....Not even with an RTB but you could fake it.. Actually it is not possible but you forget one thing I think he need this only at form load ....I think you forgot it hehehehe
I am talking about RTF option - TextRTF ; SelRTF etc..
Richtextbox is supported RTF.....

Here 2 year ago i created a program like that I used 2 RichTextBoxes for this one for one data and another for another data.And I used this code

Private Sub Command1_Click()
rt1.SelRTF = rt2.TextRTF
rt1.SelAlignment = vbRightJustify
rt2.SelAlignment = vbLeftJustify
End Sub

Private Sub Form_Load()
rt1.Text = "300"
rt2.Text = "250"
rt1.SelAlignment = vbRightJustify
rt2.SelAlignment = vbLeftJustify
End Sub

Here when you click that Command Button 1 then this will happen [ Look the Image I Posted here ....

I think you can add one more rich text else it will work correctly only for the first time .... Becoz in this if you clicked again and again it will come with new Number in Textbox 2 with the old number in Textbox 1 ...If you changed the value in first text box then everything will go wrong !!!

Note : If you added one more text then it will not become correct but it will show in different lines . Here is the code for that ...

Private Sub Command1_Click()
rt1.SelRTF = rt3.TextRTF
rt1.SelRTF = rt2.TextRTF
rt1.SelAlignment = vbRightJustify
rt2.SelAlignment = vbLeftJustify
rt3.SelAlignment = vbRightJustify
End Sub

Private Sub Form_Load()
rt1.Text = "300"
rt2.Text = "250"
rt3.Text = "500"
rt1.SelAlignment = vbRightJustify
rt2.SelAlignment = vbLeftJustify
rt3.SelAlignment = vbRightJustify
End Sub

Private Sub rt1_Change()
rt1.SelAlignment = vbRightJustify
rt2.SelAlignment = vbLeftJustify
rt3.SelAlignment = vbRightJustify
End Sub

Edited 7 Years Ago by Vineeth K: n/a

Comments
very helpful
Attachments rm_rtf.jpg 12.73 KB

Hmmm....

1. your example pic shows both left aligned
2. multiple controls (op said one)
3. example also shows RTB's with style of 3D which would put an artifact in the center of the two text areas. Style would need to be flat and if OP wanted to have that 3D border then OP would also have to contain the two text/rtb's within a picturebox (as it has the same/simular 3D border.

Comments
very helpful

Hey please look at that image carefully there is one more text in right side ...and it is in right alignment .....And i used another text to get the second number which is in different alignment ....
The rich text box in bottom is just dummy ..In this post i added text with different alignment and different font into the one rich text box.

Please run the code then there will be no doubts hehehehe ....
Here a new image . i marked text [ they are in different fonts and alignment...And all texts are in one rich text box ....!!!

Like this you can show texts with different fonts in one rich text box.Just add a code to change the font of rich text box 2 and run the program you can see it .....

Try it ....

Edited 7 Years Ago by Vineeth K: n/a

Attachments frm_RTF.jpg 15.68 KB

Yes but the first code will help you to bring those in one line the problem is after that it will not work ..............
Please carefully look at the first picture the first 2 numbers are in one line and their font is different too.But after that it will go wrong.
Or there is one method [ i never tested before ......] save that file when it become in one line as a rtf file .and load it when you need it ....hehehehe

We can bring those different alignment and fonts into one Rich text box.

after a 24-7 coding of this thread.i still not get the right solution. I have decided to create an activex control, to put two textbox that is borderless then i will overlap their 2 edges to make it look one textbox.

I have not started to build this yet. But is this the closest solution to make this program running? If it is, please help me guys bring the future activex control for this?

Thank you guys for your time.!

Edited 7 Years Ago by blocker: n/a

I have not started to build this yet. But is this the closest solution to make this program running? If it is, please help me guys bring the future activex control for this?

hmmmmm .... In this case you can only do with coding is what i did [ there may\must be another way ....think boy ..........] .Else you are right can create an active x control.It will help you to use it again and again hehehe.
Or If you don't know to create an active x control then just add that 2 RTB into the form directly without borders ...hehehehe .....

And Remember If possible make that RTB's maximum long ..becoz if the number become big then it is easy to understand that you are using 2 boxes.Please restrict numbers up to a maximum size...

If you want to use that only for the first time you can use the first code ...it will work.

I have not started to build this yet. But is this the closest solution to make this program running? If it is, please help me guys bring the future activex control for this?

hmmmmm .... In this case you can only do with coding is what i did [ there may\must be another way ....think boy ..........] .Else you are right can create an active x control.It will help you to use it again and again hehehe.
Or If you don't know to create an active x control then just add that 2 RTB into the form directly without borders ...hehehehe .....


If you want to use that only for the first time you can use the first code ...it will work.

thank you.

but the use of two textbox in a form is hard to bind in any grid. In this case activex control wiil solve this problem. thank you very much guys. If you are willing to help me build the active x then thank you again?..hehehe

Edited 7 Years Ago by blocker: n/a

This article has been dead for over six months. Start a new discussion instead.