473,396 Members | 1,797 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,396 software developers and data experts.

Changing a public string

I have this line of code
Public Navn1 As String = "Per"

I want to change it to another 'text' by entering some text in a textbox
like

navn1 = 'Nils'

and then the line should look like

Public Navn1 As String = "Nils"

How do I do that?

regards

reidarT
Nov 21 '05 #1
7 4422
I am not sure if I understand your question. But if you want to change the
value that is stored in the string, when you enter something in a textbox.
Write code in one of the Textboxe's events (Exit, TextChanged) to set the
value of the string as
navn1 =Textbox1.Text.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"ReidarT" wrote:
I have this line of code
Public Navn1 As String = "Per"

I want to change it to another 'text' by entering some text in a textbox
like

navn1 = 'Nils'

and then the line should look like

Public Navn1 As String = "Nils"

How do I do that?

regards

reidarT

Nov 21 '05 #2
Yes I can see this, but I want the public string to change so that the next
time I open the form it contains the new value/text.
regards
reidarT

"Anand[MVP]" <An******@discussions.microsoft.com> skrev i melding
news:C7**********************************@microsof t.com...
I am not sure if I understand your question. But if you want to change the
value that is stored in the string, when you enter something in a textbox.
Write code in one of the Textboxe's events (Exit, TextChanged) to set the
value of the string as
navn1 =Textbox1.Text.

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"ReidarT" wrote:
I have this line of code
Public Navn1 As String = "Per"

I want to change it to another 'text' by entering some text in a textbox
like

navn1 = 'Nils'

and then the line should look like

Public Navn1 As String = "Nils"

How do I do that?

regards

reidarT

Nov 21 '05 #3
Reidar,
Public Navn1 As String = "Per"
I want to change it to another 'text' by entering some text in a textbox
like
navn1 = 'Nils'
and then the line should look like
Public Navn1 As String = "Nils"
How do I do that?


If I would dot this as you ask, than I would use probably something as this
code in the leave or validating event of the textbox

If mytextbox.text = "navn1" then
navn1 = replace.mytextbox.text(navn1 = ',"")
navn1 = replace.mytextbox.text("'","")
end if

However I would never do things like this. It gives only misunderstandings
and not resolved errors.

I hope this helps,

Cor
Nov 21 '05 #4
ReidarT wrote:
Yes I can see this, but I want the public string to change so that the next
time I open the form it contains the new value/text.
regards
reidarT


You want to change the sourcecode when running the program? I think
you'd be better off saving things like these to a config file or
database. Then when opening the form you read the default value for that
variable from the config file/database.
--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #5
Reidar,

As I understand now from Rinze, do you mean in your code?

Cor
Nov 21 '05 #6
I know I can use a config.file, but I thought it would be easier if I had a
form to change a public value.
If I wanted to change the default username, or something like that.
regards
reidarT
"Cor Ligthert" <no************@planet.nl> skrev i melding
news:ee**************@TK2MSFTNGP12.phx.gbl...
Reidar,

As I understand now from Rinze, do you mean in your code?

Cor

Nov 21 '05 #7

"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl> wrote in message
news:hr********************@zeelandnet.nl...
ReidarT wrote:
Yes I can see this, but I want the public string to change so that the
next time I open the form it contains the new value/text.
regards
reidarT


You want to change the sourcecode when running the program? I think you'd
be better off saving things like these to a config file or database. Then
when opening the form you read the default value for that variable from
the config file/database.
--
Rinze van Huizen
C-Services Holland b.v.


Why not save it in the registry? It sounds to me like you don't need
something that actually changes the code, but checks to see what the latest
value was the last time the form was opened.

Dave
Nov 21 '05 #8

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

Similar topics

4
by: Pokerkook | last post by:
Hello, If anybody could help me with this I would greatly appreciate it. Or at least tell me why I get the output of this garbage: 49 49 10 49 52
1
by: Tim Nelson | last post by:
I am building a data bound application for SQL server which all the forms I use sqlconnections generated by VS. I want to have a login form that changes the connection depending upon login...
6
by: Aussie Rules | last post by:
Hi, THe following code (in c# has been provided to me as an answer in another question).. however I can work out where to place the code. I need a public string so that i can access a string...
7
by: JR123 | last post by:
I need some help. When the user enters a number if there is a match I want it to display as a hyperlink to that specific section of an intranet site we have at work. I have quite a lot of data but...
12
by: Eyadtrabulsi | last post by:
Hello, I'm new member, Please someone help me.. I got image's address using Server.MapPath and returned it to .ImageURL of the ImageButton but it didn't work I noticed later that if I added \\\ 3...
5
by: adeel shahid | last post by:
I m using .NET Crystal Report but i have to create report using different servers. right now the connection string is static using store procedure but i want to change the connection string at...
3
by: Mage1989 | last post by:
I am writing a program that changes ascii input to text. That itself is not hard. My problem is this, the format for the ascci input is rather weird. 42$28$50$65$79$62$77$37$56$ Now, I can put...
9
by: sarajan82 | last post by:
Hi All, I have a string represented by char* (I do not user string class): char *s="abcd"; Assume I want to remove the last two elements of s. What is the standard solution for this? Can I...
1
by: SreeBooty | last post by:
I am using c#,windows form and sql server 2005 for my development,for data acess i am using the table adapters.i want to change the connection string at runtime,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.