# Visual Basic > Visual Basic 6 and Earlier >  Textbox with left justify property but ...

## Adebiyi24

Hello
I'm looking for using a multiline textbox with left justify property but having the a characteristic of a right justify.
I explain :
I need to leave about 15 or 20 vbtabs or spaces at the beginning of the line but I come to the end of the line , I want to the line to move backword not to move at the new line. 
Is this possible?
thank you all

----------


## SamOscarBrown

Not only possible, but is the default action of one...



what am i not understanding....ML textbox, align property = right....start typing in it and it moves backwards...

Confused (see my signature)

Sam I Am

----------


## Adebiyi24

SamOscarBrown 
thans for your interest
if you set alignement to "Right", how can you determine the vbtabs (spaces) at the beginning of the line. 
How can you produce something like this? 
And when you add something, the line moves backward?

----------


## SamOscarBrown

Still confused...sorry.

So, maybe it isn't a multi-line textbox you need for your project.

Can you explain better what you are trying to do?  For example, in your last post you said "how can you determine the vbtabs (spaces)...what do you mean by 'determine'?
Or in other words...you may be looking to REMOVE some of those spaces as you type after some certain point (the right edge???).  Correct?  But if that is true (based upon your first post), your example shows a lot of space AFTER the "ccccccc" before the right edge...
So, still not understanding (even with your picture) what you want to accomplish, and WHY?.

Maybe a grid with columns and rows might be what you are looking for...can't tell by your explanations so far.  Tell us the grander scheme of things here.

Sammi

----------


## techgnome

Sounds like the OP is looking for a "margin" setting ... that will indent the text a certain amount. What's not obvious is what should happen to those spaces/tabs as the user types. Do they remain? Are they deleted? What happens when there is no more to delete?

I think the WHY is going to be the key here... and I'm willing to go so far as to suggest, that it isn't needed, and that it's trying to solve a problem that's not really a problem, but is something else entirely.


-tg

----------


## Adebiyi24

> Still confused...sorry.


I'm sorry for that




> So, maybe it isn't a multi-line textbox you need for your project.


It is a multi-line textbox




> Can you explain better what you are trying to do?  For example, in your last post you said "how can you determine the vbtabs (spaces)...what do you mean by 'determine'?


In fact I 'm exporting data from listview to textbox.
I'm leaving some space at the left edge.


```
Text1.Text = Space(20) & &  lvw.SelectedItem.Text
```

Sometimes data is too long, so I want  the line to move backward the same way as in  right alignement textbox. And of course the space at the beginning of the line will be removed. 




> Or in other words...you may be looking to REMOVE some of those spaces as you type after some certain point (the right edge???).  Correct?  But if that is true (based upon your first post), your example shows a lot of space AFTER the "ccccccc" before the right edge...


that's true.
that'swhy I said i want the line to backward if I type or copy something after the
 "ccccccc"




> Maybe a grid with columns and rows might be what you are looking for...can't tell by your explanations so far.  Tell us the grander scheme of things here.


In fact I nee a textbox
thank you

----------


## Adebiyi24

> Sounds like the OP is looking for a "margin" setting ... that will indent the text a certain amount. What's not obvious is what should happen to those spaces/tabs as the user types. Do they remain? Are they deleted? What happens when there is no more to delete?
> 
> I think the WHY is going to be the key here... and I'm willing to go so far as to suggest, that it isn't needed, and that it's trying to solve a problem that's not really a problem, but is something else entirely.
> 
> 
> -tg


Mybe this illustration will help me to clarify the issue
This is what is  happening now

this is what I need

thank you

----------


## SamOscarBrown

Ok...I see you have better explained the "WHAT?".




> Text1.Text = Space(20) & & lvw.SelectedItem.Text[/CODE]
> Sometimes data is too long, so I want the line to move backward the same way as in right alignement (sic) textbox. And of course the space at the beginning of the line will be removed.


..now, let's try the "WHY?".

WHY are you pulling this information OUT OF a ListView and INTO a ListBox?  What functionality do you need from a ListBox that you don't think you have with a ListView?  Do you need a user to EDIT this ML Listbox?  What's the purpose?  

I also believe the "WHY?" *IS* the operative question for your project.

----------


## Adebiyi24

> WHY are you pulling this information OUT OF a ListView and INTO a ListBox?





> In fact I 'm exporting data from listview to textbox.


I think I don't need now to answer the why question

----------


## SamOscarBrown

Okay...np problem...don't then.  And because you only answered WHAT, and not WHY you want to do this (other than I want to), I am outa here.

Hope someone else can help you.

Sam

----------


## Arnoutdv

Do you just want a big white border on the left side of the text?

----------


## Adebiyi24

> Do you just want a big white border on the left side of the text?


To make a white border on the left side of the text; I can do this:



> Text1.Text = Space(20)  &  lvw.SelectedItem.Text


What I want is a textbox with left alignement property but behaving as a right alignement textbox.
I mean if I type something , it moves backward as long as there is space at the beginning of the line.

----------


## Arnoutdv

So right align is fine, but you want different behavior when a line wraps, then the rest of the line should be left aligned?
I don't think there are any pre-made controls which have this behavior.

----------


## DataMiser

> What I want is a textbox with left alignement property but behaving as a right alignement textbox.
> I mean if I type something , it moves backward as long as there is space at the beginning of the line.


Your posts really don't make much sense if you want the spaces to dissappear as you type then you can do that in the keypress event by just checking to see if the first character is a space and if so remove it but you are also talking about adding items from a list view which means they will not be typed in the text box at all so your description of what you want to happen does not apply. You could set the font to a fixed font then check the length of the string and add or remove spaces as need to get up to your min length.

Of course you still have not said why you want it to do this nor have you given a good description of what you want it to do making it difficult to understand and difficult to try and help.

----------


## Adebiyi24

DataMiser
Your contribution is helpful to me and gave good insiration.



> if the first character is a space and if so remove it


Please could you provide a code for doing this in the keypress event?
I can delete space like this:


```
txtD = Replace(txtD, " ", "")
```

But how to do remove  space at the beginning of the line?
thank you a lot

----------


## DataMiser

> If Left$(Text1.Text,1)=" " then Text1.Text =Mid$(Text1.Text,2)


This assumes that there is more than one character in text1.text if there is just a single space with nothing after would generate an error.

----------


## Adebiyi24

thanks DataMiser but this works only with thr first line.

----------


## SamOscarBrown

DM---suggest you give up...he does NOT need what he is asking for (at least in a ML textbox!).

Outa here for good.

----------


## DataMiser

> thanks DataMiser but this works only with thr first line.


Well. Like I said your description is not very good and you still haven't said why you need to do this. Most likely if you explained why someone would point you to a different method that makes more sense.

That said what I showed was a simple example you would have to apply that to the line in question rather than the entire text but I really can not see any reason to do this so maybe I'll just take Sams advice and leave it.

----------

