?
Solved

Parsing txtInputString into a string type variable

Posted on 2003-03-04
9
Medium Priority
?
201 Views
Last Modified: 2010-05-01
Here's my scenario:

I need to create a text box named (for example) "txtInputString01".  The text box, in this example will type in "SuperCaliFragaSomethingOrAnother"

I need to create a button that when clicked evaluates the content of (in this example) the "txtInputString01" and parses it into a string type variable which is displayed in a MsgBox containing the left-most character of the string, plus the 6th through 9th characters, plus the last 7 characters.

Thanks in advance!

0
Comment
Question by:GlobalFax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:Jacamar
ID: 8068876
Private Sub Command2_Click()
Dim ststring As String
Dim mystring As String
Dim mylaststring As String

ststring = Text1.Text

mystring = Mid(ststring, 1, 1)
mylaststring = mystring

mystring = Mid(ststring, 6, 4)
mylaststring = mylaststring & mystring

mystring = Mid(ststring, inCounter - 6, 7)
mylaststring = mylaststring & mystring

Text2.Text = mylaststring
End Sub
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8068877
I know it doesn't look so great, but it will get the job done.
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8068879
sorry,

Call msgbox (mylaststring, vbinformation)

add this instead of the Text2.text = mylaststring
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:Jacamar
ID: 8068886
sorry, you need something else too.
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 2000 total points
ID: 8068907
'' get string from textbox
Dim strText as String
Dim strParsed as String

strText = txtInputString01.text
strParsed = left(strText, 1) & mid(strText, 6, 3) & right(strText, 7) '' get left most, 6-9, and last 7 chars
msgbox strParsed '' msgbox it
0
 
LVL 11

Expert Comment

by:supunr
ID: 8068918
Why is this question worth such a high number of points? Is there any tricks to this question.  Previous answer is perfectly correct.
0
 

Expert Comment

by:tWiZtEr_RX
ID: 8068965
Private Sub Command1_Click()
' get string from textbox
Dim strText As String
Dim strParsed As String

strText = txtInputString01.Text
strParsed = Left(strText, 1) & Mid(strText, 6, 3) & Right(strText, 7) ' get left most, 6-9, and last 7 chars
MsgBox strParsed ' msgbox it
End Sub
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8068979
wow, looks familiar ;)
0
 
LVL 1

Author Comment

by:GlobalFax
ID: 8069067
Perfect answer!  I already had button name so I just had to make a name change!

As for why so many points?  No trick, I'm just in a good mood!

Thanks to all!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question