473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Variable inside Textbox

Hello All,
Is it possible to place a variable inside of a textbox and have it
viewed as the value? Or even read in as a string. Here's the
problem... I have a text file I would like to read in to my program.
It is for an email that gets sent out automatically. I would like
anyone to be able to edit the email through the text file. I was
hoping the text file could look something like this:

----------------
Dear "username",

You have reserved a loaner laptop for "begindate". It should be picked
up on "pickupdate" and should be returned on "dropoffdate".
Thanks
Mgmt
----------------

Is this at all possible? Mgmt would like to be able to change the
wording from time to time, however I don't know if it is possible to
read in a string like this and have the variables automatically be
switched to their values. i have been searching for three days and it
appears that this has never been addressed before. Thanks for your
help, even if it is telling me that this is not possible.

Matt

Nov 21 '05 #1
7 1206
You can consider using the Tag property of the TextBox to store the variable
name.

Serge O.

<no****@meatonconsulting.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hello All,
Is it possible to place a variable inside of a textbox and have it
viewed as the value? Or even read in as a string. Here's the
problem... I have a text file I would like to read in to my program.
It is for an email that gets sent out automatically. I would like
anyone to be able to edit the email through the text file. I was
hoping the text file could look something like this:

----------------
Dear "username",

You have reserved a loaner laptop for "begindate". It should be picked
up on "pickupdate" and should be returned on "dropoffdate".
Thanks
Mgmt
----------------

Is this at all possible? Mgmt would like to be able to change the
wording from time to time, however I don't know if it is possible to
read in a string like this and have the variables automatically be
switched to their values. i have been searching for three days and it
appears that this has never been addressed before. Thanks for your
help, even if it is telling me that this is not possible.

Matt

Nov 21 '05 #2
Thanks Serge,
I have never used the tag property before. Would I still be able to
keep the variable in my email.txt file? I've tried a couple of
different things with the syntax but it is not working. I am not sure
how to code something like that. MSDN says:
Use the Tag property to assign an identification string to an object
without affecting other property settings or attributes.

For example, you can use Tag to check the identity of a form or control
that is passed as a variable to a procedure.

This only confused me. Thanks for your patience and any possible
examples.

Matt
S. Olivier wrote:
You can consider using the Tag property of the TextBox to store the variable name.

Serge O.

<no****@meatonconsulting.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hello All,
Is it possible to place a variable inside of a textbox and have it
viewed as the value? Or even read in as a string. Here's the
problem... I have a text file I would like to read in to my program. It is for an email that gets sent out automatically. I would like
anyone to be able to edit the email through the text file. I was
hoping the text file could look something like this:

----------------
Dear "username",

You have reserved a loaner laptop for "begindate". It should be picked up on "pickupdate" and should be returned on "dropoffdate".
Thanks
Mgmt
----------------

Is this at all possible? Mgmt would like to be able to change the
wording from time to time, however I don't know if it is possible to read in a string like this and have the variables automatically be
switched to their values. i have been searching for three days and it appears that this has never been addressed before. Thanks for your
help, even if it is telling me that this is not possible.

Matt


Nov 21 '05 #3
Example:

Sub MyTag()
Me.txtMail.Tag = "EmailAddress"
Me.txtMail.Text = <your value>
End Sub

Or to find which control has the Tag value "EmailAddress", For Each ctl in
Me.Controls ... If ctl.Tag = "EmailAddress" Then...

HTH

Serge
<no****@meatonconsulting.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Thanks Serge,
I have never used the tag property before. Would I still be able to
keep the variable in my email.txt file? I've tried a couple of
different things with the syntax but it is not working. I am not sure
how to code something like that. MSDN says:
Use the Tag property to assign an identification string to an object
without affecting other property settings or attributes.

For example, you can use Tag to check the identity of a form or control
that is passed as a variable to a procedure.

This only confused me. Thanks for your patience and any possible
examples.

Matt
S. Olivier wrote:
You can consider using the Tag property of the TextBox to store the

variable
name.

Serge O.

<no****@meatonconsulting.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
> Hello All,
> Is it possible to place a variable inside of a textbox and have it
> viewed as the value? Or even read in as a string. Here's the
> problem... I have a text file I would like to read in to my program. > It is for an email that gets sent out automatically. I would like
> anyone to be able to edit the email through the text file. I was
> hoping the text file could look something like this:
>
> ----------------
> Dear "username",
>
> You have reserved a loaner laptop for "begindate". It should be picked > up on "pickupdate" and should be returned on "dropoffdate".
> Thanks
> Mgmt
> ----------------
>
> Is this at all possible? Mgmt would like to be able to change the
> wording from time to time, however I don't know if it is possible to > read in a string like this and have the variables automatically be
> switched to their values. i have been searching for three days and it > appears that this has never been addressed before. Thanks for your
> help, even if it is telling me that this is not possible.
>
> Matt
>

Nov 21 '05 #4
The problem is the data always changes. The username gets pulled from
txtusername. Would this still work with this example?

Nov 21 '05 #5
That is why I wanted the text file. I was even wondering if I could
read the text file into a string with the text file looking something
like this:

"Dear " & txtusername.text & "," & vbcrlf

"You have reserved a loaner laptop for " & txtbegindate.text & ". It
should be picked
up on " & txtpickupdate.text & " and should be returned on " &
txtdropoffdate.text & "." & vbcrlf
"Thanks" & vbcrlf & "Mgmt"

Is there a way to read that whole text file into a string or textbox
and have it read with the variables filled in?

Nov 21 '05 #6
I see,
In this case, you could intruduce key words in your document (text file)
like [Username] and perform a Replace(x,y,z) with the values found in the
controls.

HTH
<no****@meatonconsulting.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
That is why I wanted the text file. I was even wondering if I could
read the text file into a string with the text file looking something
like this:

"Dear " & txtusername.text & "," & vbcrlf

"You have reserved a loaner laptop for " & txtbegindate.text & ". It
should be picked
up on " & txtpickupdate.text & " and should be returned on " &
txtdropoffdate.text & "." & vbcrlf
"Thanks" & vbcrlf & "Mgmt"

Is there a way to read that whole text file into a string or textbox
and have it read with the variables filled in?

Nov 21 '05 #7
Perfect! Thanks for your support. I really appreciate it!

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: What-a-Tool | last post by:
I want to display a session variable as a textbox value: <input type="text" ...... value="<%=Session("myvar")%>"> I've tried several different variation of this and can't get it to display...
1
by: Epson Barnett | last post by:
Hi, I'm new to C# and I'd like to be able to reference a field of an object using a variable instead of literal text. In the PHP scripting language, you can create a variable: $var = "name";...
2
by: Scott Kelley | last post by:
I have a control inside of an asp:Table control. Once I place it in there, I can't seem to edit it any more (Double click to add events, drag to reposition, etc...). If I use an HTML table, no...
0
by: John Shum | last post by:
I prepare a UserControl that act as a lookup control, once the code is enter in the TextBox, the description will appear in another TextBox outside the UserControl of the same row in a DataGrid via...
5
by: rodchar | last post by:
Hey all, Given: strVal1 = array.getvalue(0) Is there a way I can have a variable in place of strVal1 that will point to strVal1. I guess what I'm asking is if there's a way to make a...
2
by: Cliff | last post by:
Hi, i would like to get the value of variable 'em', defined in code-behind, into a textbox. I tried two ways but withoit succes (no error). The first textbox is empty, the second gets:<%=em...
0
by: cscan | last post by:
Hi all, I write 2 controls. (Acutally I simplifed my project here) MyTextBox and MyPanel. MyPanel contains a property which is a collection of MyTextBox. public partial class MyPanel :...
2
by: Grant | last post by:
How do I, if at all possible, reference a variable with another variable in VB.NET? For example, if I have a form with a textbox and a button. Type var1 in the textbox Private Sub...
1
by: Øyvind Isaksen | last post by:
I need to know how to handle controls inside a repeater, how to send and recieve data from another page to one spesific control inside a repeater. Clue: I have a repeater that dynamicly lists...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.