HELP: how to put a dot inside a textname

xplorer

New member
Local time
Today, 11:34
Joined
Jul 15, 2010
Messages
6
Hi guys,

I am very new to programming in vb6 only. I am learning this through self-study as a hobby. I would like to know how to put a dot inside a textname like for example:

Example 1: if I say variable x=1 then a text would look like this A.CCESS
Example 2: if I say variable x=3 then a text would look like this ACC.ESS
Example 3: if I say variable x=7 then a text would look like this A.C.CESS
Example 4: if I say variable x=8 then a text would look like this A.CC.ESS
Example 5: if I say variable x=12 then a text would look like this AC.CESS
Example 6: if I say variable x=13 then a text would look like this AC.C.ESS

The essence is that from A.CCESS it will have a last possible combination to A.C.C.E.S.S. using on ONE dot.

Hopefully someone can help me even though what I ask has no meaning, but it has a purpose for me.

Thanks in advance.
 
Last edited:
Get the lenght of the input string using the Len() function.
The position of the dot will be some function of x and this length.

Use the Left() and Mid() functions with this value to get the characters which are to be to the left and right of the dot and concatenate them together.
 
this is my current code


Text3.Text = Left(Text2.Text, Val(Text1.Text)) & "." & Right(Text2.Text, (Len(Text2.Text) - Val(Text1.Text)))

this is only successful if the value of text1 is the same or lesser that text2.

I dont know how to do if text1 is greater than the length of text2 which the result if like A.C.CESS

Kindly help me sir.
 
Example 1: if I say variable x=1 then a text would look like this A.CCESS
Example 2: if I say variable x=3 then a text would look like this ACC.ESS
Example 3: if I say variable x=7 then a text would look like this A.C.CESS
Example 4: if I say variable x=8 then a text would look like this A.CC.ESS
Example 5: if I say variable x=12 then a text would look like this AC.CESS
Example 6: if I say variable x=13 then a text would look like this AC.C.ESS

What is the logic? how does the variable x translate to the literal position in the word?

Example 1 states that x = 1 however the position of the dot in the word is at position 2

likewise how in example 6 does 13 translate itself to positions 3 and 5?

The placement of the dots would rely on a constant logical interpretation which using the examples you have provided eludes me.
 
Thanks for your reply Sir Dcrake.

I really dont know what logic to apply there. That the examples I presented is what I have in mind that the result should be.

I have three textbox

1st textbox holds the number which is he basis of the dot position
2nd textbox holds the character of letters that is used for the dot positioning
3rd textbox will hold the result on change of the 1st textbox value.


Do you have any idea how I can do this dot positioning. Or maybe you can even more clarify me more on this if my idea on this matter is vague so as to produce the desired result. Thank you.
 
Even more confused:confused: Perhaps if you are learning VB then you should try something more simple to start with. Trying to complete something that you can't even understand is not the way to go.

If the example has come from a text book, or is actually an assignment I would like to look at the actual senerio itself.
 
From Example 4 down, it confuses me too.

Example 3: if I say variable x=7 then a text would look like this A.C.CESS
Example 4: if I say variable x=8 then a text would look like this A.CC.ESS

On example 3, the length of the character ACCESS is only 6, since on first value of 1 the dot is position after "A" we cannot position value 7 the same as with position for value 1, therefore, the next position is position after "A" and "C". this is the second round until we reach "A.CCESS." position.

So at the third round, the position will be "AC.CESS" and next "AC.C.ESS".
 
Yes that was what I had thought but you have two dots in there which isn't logical. First I thought that maybe the text used in example 4 was the text in example 3 but when I got to example 5 it wasn't so.

I think you have to re-evaluate what you're trying to achieve.
 
Do you have any suggestion sir vbaInet like what I need to accomplish?

with regards to example 5, sorry it was an typographical error

that should be

Example 5: if I say variable x=12 then a text would look like this AC.C.ESS
Example 6: if I say variable x=13 then a text would look like this AC.CE.SS
 
Well you seem to understand the logic, but I don't, and I can't think of a situation where I would need this logic. However to test your own understanding

What is the result of variable
x = 27

Where the textname is
MICROSOFT
 
M.ICROSOFT
MI.CROSOFT
MIC.ROSOFT
MICR.OSOFT
MICRO.SOFT
MICROS.OFT
MICROSO.FT
MICROSOF.T
MICROSOFT.
M.I.CROSOFT
M.IC.ROSOFT
M.ICR.OSOFT
M.ICRO.SOFT
M.ICROS.OFT
M.ICROSO.FT
M.ICROSOF.T
M.ICROSOFT.
MI.C.ROSOFT
MI.CR.OSOFT
MI.CRO.SOFT
MI.CROS.OFT
MI.CROSO.FT
MI.CROSOF.T
MI.CROSOFT.
MIC.R.OSOFT
MIC.RO.SOFT
MIC.ROS.OFT

number 27th would be MIC.ROS.OFT

what could be the possible way to go about this Sir? Is this kind of looping but I cant think of how to code this.
 

Users who are viewing this thread

Back
Top Bottom