# remove a letter or number

Hi,
lets say i have the following word: Hello
SO when i press a button i want to remove the "o" and if i press it again to remove the "l" ctr..

i think i must use a function...but i dont know which and how.

thanks.

## Comments

• : Hi,
: lets say i have the following word: Hello
: SO when i press a button i want to remove the "o" and if i press it
: again to remove the "l" ctr..
:
: i think i must use a function...but i dont know which and how.
:
: thanks.

Use Left\$, Mid\$ and Right\$ to take portions of the string.
Basically, removing a character at position n (where position 1 is the first character) means: Left\$(s, n - 1) & Mid\$(s, n + 1). This is taking the part before the character-to-be-removed, and the part after and pasting them back together.

Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
• : : Hi,
: : lets say i have the following word: Hello
: : SO when i press a button i want to remove the "o" and if i press it
: : again to remove the "l" ctr..
: :
: : i think i must use a function...but i dont know which and how.
: :
: : thanks.
:
: Use Left\$, Mid\$ and Right\$ to take portions of the string.
: Basically, removing a character at position n (where position 1 is
: the first character) means: Left\$(s, n - 1) & Mid\$(s, n + 1). This
: is taking the part before the character-to-be-removed, and the part
: after and pasting them back together.
:
: Best Regards,
: Richard
:
: The way I see it... Well, it's all pretty blurry
:
IMHO it will be better idea to use Replace() and InStr() functions.

Replace([italic]Expession as String,Find as String,Replace as String,[Start as Long = 1],[Count as Long = 1][/italic]) As String

InStr([[b]Start[/b]],[[italic]String1[/italic]],[[italic]String2[/italic]]) As Long

Something like that

[code]
Dim strSelText As String

If InStr(Text1, "o") > 0 Then
strSelText = "o"
Text1 = Replace(Text1.Text, strSelText, "", 1)
Else
If InStr(Text1, "e") > 0 Then
strSelText = "e"
Text1 = Replace(Text1.Text, strSelText, "", 1)
End If
End If[/code]
Or this code
[code]
Private Sub Command1_Click()

Dim strSelText As String
strSelText = Right(Text1, 1) 'select last letter
Text1 = Replace(Text1.Text, strSelText, "", 1, 1)
End Sub
[/code]
Of course it's just an idea and you have to modify it according to your needs
• :
: IMHO it will be better idea to use Replace() and InStr() functions.
:

Only if you want to replace a specific character.
Depending on whether you have the position or the character, you should use Left/Mid, respectively Replace. InStr can be used to find the position of the character, but is useless if you're already using replace. If you have the position, you could use Mid\$ to get the character, but this is also useless because you'd then be able to use Left/Mid.

So, conclusion: depending on what you know, you should either use Left/Mid or Replace. In speed, I doubt that Replace is at all faster (though it is possible that the developer team optimized replace).

Best Regards,
Richard

The way I see it... Well, it's all pretty blurry
• : :
: : IMHO it will be better idea to use Replace() and InStr() functions.
: :
:
: Only if you want to replace a specific character.
: Depending on whether you have the position or the character, you
: should use Left/Mid, respectively Replace. InStr can be used to find
: the position of the character, but is useless if you're already
: using replace. If you have the position, you could use Mid\$ to get
: the character, but this is also useless because you'd then be able
: to use Left/Mid.
:
: So, conclusion: depending on what you know, you should either use
: Left/Mid or Replace. In speed, I doubt that Replace is at all faster
: (though it is possible that the developer team optimized replace).
:
: Best Regards,
: Richard
:
: The way I see it... Well, it's all pretty blurry

Thank you very much to all of you.
Your solutions helped me a lot!
• [color=Blue]So, conclusion: depending on what you know, ...[/color]
I like your conclusion :-)
Personally, I am not big user of InStr() function and just tried to show krals how different VB string functions and/or their combinations could be used.
• : Thank you very much to all of you.
: Your solutions helped me a lot!
:
You are welcome
• ok guys, one last question:

I have made a package (in order to install it properly to another pc),so when i run the setup to the other pc i get message:"setup cannot continue because some system files are of date on your system.Click if you would like setup to update these files for you now.You will need to restart Windows before you run the setup again".I press ok,i restart pc but i get the same message even doing the restart.
I have to say that i just setup this PC with windows,so no updates are installed.

Is there any solution for this? or i have to make a windows update?
• : ok guys, one last question:
:
: I have made a package (in order to install it properly to another
: pc),so when i run the setup to the other pc i get message:"setup
: cannot continue because some system files are of date on your
: system.Click if you would like setup to update these files for you
: now.You will need to restart Windows before you run the setup
: again".I press ok,i restart pc but i get the same message even doing
: the restart.
: I have to say that i just setup this PC with windows,so no updates
: are installed.
:
: Is there any solution for this? or i have to make a windows update?
:
Yeah ... I remember this stupid problem but do not remember how to fix it. There are some system files in your package whoes versions are older than one on your new machine. I think you have to install Visual Studio SP6 on machine where Application and Package were created then rebild package. Try following link (copy and paste it to the address bar)

http://support.microsoft.com/default.aspx?scid=kb;EN-US;192461

• Ok,i fixed it like this:
I installed from VB6 cd-rom only the ActiveX Controls and Database tools (ADO,DAO ctr).I tried to run setup again but i got the same error again.
So i just copied the .exe file and run it.
Everything works fine except one thing: I have a calendar control which is used to save a date,so when i press the button to save it i get:
"Run time error: -2147352560 (80020010)

Automation error
invalid callee"

(i have posted this problem some days before..a similar problem)

• : Ok,i fixed it like this:
: I installed from VB6 cd-rom only the ActiveX Controls and Database
: tools (ADO,DAO ctr).I tried to run setup again but i got the same
: error again.
: So i just copied the .exe file and run it.
: Everything works fine except one thing: I have a calendar control
: which is used to save a date,so when i press the button to save it i
: get:
: "Run time error: -2147352560 (80020010)
:
: Automation error
: invalid callee"
:
: (i have posted this problem some days before..a similar problem)
:
:
:
:

here's a work around i used on an install that kept asking to "need to update system files."

compare the file date/version of the [Bootstrap Files] list in "setup.lst" file [see below] to what exists on the target pc.
delete any file from the [Bootstrap Files] list when the target pc has a *newer* file version than the one in the vb6 setup.lst file

[recall receiving an error message during install but the EXE now runs on the problem pc]

[Bootstrap Files]
File1=@vb6stkit.dll,\$(WinSysPathSysFile),,,3/26/99 12:00:00 AM,101888,6.0.84.50
File2=@COMCAT.DLL,\$(WinSysPathSysFile),\$(DLLSelfRegister),,5/31/98 12:00:00 AM,22288,4.71.1460.1
File3=@stdole2.tlb,\$(WinSysPathSysFile),\$(TLBRegister),,8/23/01 8:00:00 AM,17920,3.50.5014.0
File4=@asycfilt.dll,\$(WinSysPathSysFile),,,8/4/04 12:56:42 AM,65024,5.1.2600.2180
File5=@olepro32.dll,\$(WinSysPathSysFile),\$(DLLSelfRegister),,8/4/04 12:56:46 AM,83456,5.1.2600.2180
File6=@oleaut32.dll,\$(WinSysPathSysFile),\$(DLLSelfRegister),,8/4/04 12:56:46 AM,553472,5.1.2600.2180
File7=@msvbvm60.dll,\$(WinSysPathSysFile),\$(DLLSelfRegister),,2/23/04 8:42:40 PM,1386496,6.0.97.82

• OK!! i fixed it!
I searched my PC for all files started with MSCAL.* I found about 10 files which i copied them (overwrite) to the appropriate folders to the other pc.
i found these files in two different locations:a)system32 and b)Program filesmicrosoft officeoffice11

So Calendar control works fine now.
• : OK!! i fixed it!
: I searched my PC for all files started with MSCAL.* I found about 10
: files which i copied them (overwrite) to the appropriate folders to
: the other pc.
: i found these files in two different locations:a)system32 and
: b)Program filesmicrosoft officeoffice11
:
: So Calendar control works fine now.
:
Just friendly advise. To avoid this problem in future, during building of intalation package include those files to the package.

• : Just friendly advise. To avoid this problem in future, during
: building of intalation package include those files to the package.

its not always that simple. i always create a package/install. however, that uses the files that exist "at that moment in time" on the development pc. after months have passed and you've installed microsoft updates, some of those file versions can change. then when you try to install, the setup fails.

time to recompile and rebuild an updated package. but what about when in the process of revising source code and a part of the original code has changed [think of the "team member" environment]? you need a way to be able to install the old version until a new one is ready.
• : its not always that simple.
:
I used this package last time about 5 years ago but still remember it ... It is pain of the ass. IMHO, the best way to fix it is keep developer machine up to date. In that case all those files in the package will be OK.
"Thanks" Microsoft, there is now problem like that in .NET.
Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!