By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,663 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,663 IT Pros & Developers. It's quick & easy.

Textbox text isn't updating

P: n/a
I have a textbox (textBox7) that isn't updating..
Is there a way, after I type new text in it, to have it update?
It seems to be fairly normal:

public class Form1
: System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox7;
......
private void InitializeComponent()
{
this.textBox7 = new System.Windows.Forms.TextBox();

// textBox7
//
this.textBox7.Location = new System.Drawing.Point(248, 32);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(72, 20);
this.textBox7.TabIndex = 69;
this.textBox7.Text = "";
//
this.Controls.Add(this.textBox7);
Ok, the Form1 is idol and I type "100".

then debug and watch here:
public void getTextBox7()
{
Form1 this2watch = new Form1();
string addwatch = this.textBox7.Text;<<<Nothing is in here!
Class1.watCHTimer1 = Convert.ToInt16(addwatch);
}

thanks in advance,
Trint

Thanks,
Trint

Nov 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
you type in the text, and click a button to get into this procedure?
If not, when getTextBox7() being called?
"trint" <tr***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have a textbox (textBox7) that isn't updating..
Is there a way, after I type new text in it, to have it update?
It seems to be fairly normal:

public class Form1
: System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox7;
.....
private void InitializeComponent()
{
this.textBox7 = new System.Windows.Forms.TextBox();

// textBox7
//
this.textBox7.Location = new System.Drawing.Point(248, 32);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(72, 20);
this.textBox7.TabIndex = 69;
this.textBox7.Text = "";
//
this.Controls.Add(this.textBox7);
Ok, the Form1 is idol and I type "100".

then debug and watch here:
public void getTextBox7()
{
Form1 this2watch = new Form1();
string addwatch = this.textBox7.Text;<<<Nothing is in here!
Class1.watCHTimer1 = Convert.ToInt16(addwatch);
}

thanks in advance,
Trint

Thanks,
Trint

Nov 17 '05 #2

P: n/a
I just put a value in the textbox and run a function that is supposed to
get the text from the box and assign it to a string. That's it. And
there is nothing in it.
trint

..Net programmer
tr***********@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3

P: n/a
Hi,

Who/ Where call getTextBox7() ?

do you mean that even if you type something in you do not see it on the
screen?

Please give more details

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have a textbox (textBox7) that isn't updating..
Is there a way, after I type new text in it, to have it update?
It seems to be fairly normal:

public class Form1
: System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox7;
.....
private void InitializeComponent()
{
this.textBox7 = new System.Windows.Forms.TextBox();

// textBox7
//
this.textBox7.Location = new System.Drawing.Point(248, 32);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(72, 20);
this.textBox7.TabIndex = 69;
this.textBox7.Text = "";
//
this.Controls.Add(this.textBox7);
Ok, the Form1 is idol and I type "100".

then debug and watch here:
public void getTextBox7()
{
Form1 this2watch = new Form1();
string addwatch = this.textBox7.Text;<<<Nothing is in here!
Class1.watCHTimer1 = Convert.ToInt16(addwatch);
}

thanks in advance,
Trint

Thanks,
Trint

Nov 17 '05 #4

P: n/a
Ok,
This is where it is called:
From Class1.cs:
public static void testwatcher()
{
Form1 finDWatchInt = new Form1();
do
{
finDWatchInt.getTextBox7(); <<This is the call.
watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
MessageBox.Show("Please enter a number value!");
}
while(watCHTimer1 < 1);
}

Thanks,
Trint

Ignacio Machin ( .NET/ C# MVP ) wrote: Hi,

Who/ Where call getTextBox7() ?

do you mean that even if you type something in you do not see it on the screen?

Please give more details

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have a textbox (textBox7) that isn't updating..
Is there a way, after I type new text in it, to have it update?
It seems to be fairly normal:

public class Form1
: System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox7;
.....
private void InitializeComponent()
{
this.textBox7 = new System.Windows.Forms.TextBox();

// textBox7
//
this.textBox7.Location = new System.Drawing.Point(248, 32);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(72, 20);
this.textBox7.TabIndex = 69;
this.textBox7.Text = "";
//
this.Controls.Add(this.textBox7);
Ok, the Form1 is idol and I type "100".

then debug and watch here:
public void getTextBox7()
{
Form1 this2watch = new Form1();
string addwatch = this.textBox7.Text;<<<Nothing is in here!
Class1.watCHTimer1 = Convert.ToInt16(addwatch);
}

thanks in advance,
Trint

Thanks,
Trint


Nov 17 '05 #5

P: n/a
Hi,

There are a number of thing I do not get from your code,

Why testwatcher is static?

You are not even showing the form in the first place, how do you expect it
to have a value?

Form1 finDWatchInt = new Form1();
do
{
finDWatchInt.ShowDialog(); // ********* include this line
finDWatchInt.getTextBox7(); <<This is the call.
watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
MessageBox.Show("Please enter a number value!");
}
while(watCHTimer1 < 1);
}

still I do not understand what you are trying to do.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Ok,
This is where it is called:
From Class1.cs:


public static void testwatcher()
{
Form1 finDWatchInt = new Form1();
do
{
finDWatchInt.getTextBox7(); <<This is the call.
watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
MessageBox.Show("Please enter a number value!");
}
while(watCHTimer1 < 1);
}

Thanks,
Trint

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

Who/ Where call getTextBox7() ?

do you mean that even if you type something in you do not see it on

the
screen?

Please give more details

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
>I have a textbox (textBox7) that isn't updating..
> Is there a way, after I type new text in it, to have it update?
> It seems to be fairly normal:
>
> public class Form1
> : System.Windows.Forms.Form
> {
> private System.Windows.Forms.TextBox textBox7;
> .....
> private void InitializeComponent()
> {
> this.textBox7 = new System.Windows.Forms.TextBox();
>
> // textBox7
> //
> this.textBox7.Location = new System.Drawing.Point(248, 32);
> this.textBox7.Name = "textBox7";
> this.textBox7.Size = new System.Drawing.Size(72, 20);
> this.textBox7.TabIndex = 69;
> this.textBox7.Text = "";
> //
> this.Controls.Add(this.textBox7);
>
>
> Ok, the Form1 is idol and I type "100".
>
> then debug and watch here:
> public void getTextBox7()
> {
> Form1 this2watch = new Form1();
> string addwatch = this.textBox7.Text;<<<Nothing is in here!
> Class1.watCHTimer1 = Convert.ToInt16(addwatch);
> }
>
> thanks in advance,
> Trint
>
>
>
> Thanks,
> Trint
>

Nov 17 '05 #6

P: n/a
Ignacio,
I can't do a "finDWatchInt.ShowDialog(); because the Form1 is already
showing (Form1 would then appear twice???). This happens as a result
of this button click:

public void button19_Click(object sender, System.EventArgs e)
{
Class1.testwatcher();
}
Thanks,
Trint
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

There are a number of thing I do not get from your code,

Why testwatcher is static?

You are not even showing the form in the first place, how do you expect it to have a value?

Form1 finDWatchInt = new Form1();
do
{
finDWatchInt.ShowDialog(); // ********* include this line
finDWatchInt.getTextBox7(); <<This is the call.
watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
MessageBox.Show("Please enter a number value!");
}
while(watCHTimer1 < 1);
}

still I do not understand what you are trying to do.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Ok,
This is where it is called:
From Class1.cs:


public static void testwatcher()
{
Form1 finDWatchInt = new Form1();
do
{
finDWatchInt.getTextBox7(); <<This is the call.
watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
MessageBox.Show("Please enter a number value!");
}
while(watCHTimer1 < 1);
}

Thanks,
Trint

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

Who/ Where call getTextBox7() ?

do you mean that even if you type something in you do not see it
on the
screen?

Please give more details

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
>I have a textbox (textBox7) that isn't updating..
> Is there a way, after I type new text in it, to have it update?
> It seems to be fairly normal:
>
> public class Form1
> : System.Windows.Forms.Form
> {
> private System.Windows.Forms.TextBox textBox7;
> .....
> private void InitializeComponent()
> {
> this.textBox7 = new System.Windows.Forms.TextBox();
>
> // textBox7
> //
> this.textBox7.Location = new System.Drawing.Point(248, 32);
> this.textBox7.Name = "textBox7";
> this.textBox7.Size = new System.Drawing.Size(72, 20);
> this.textBox7.TabIndex = 69;
> this.textBox7.Text = "";
> //
> this.Controls.Add(this.textBox7);
>
>
> Ok, the Form1 is idol and I type "100".
>
> then debug and watch here:
> public void getTextBox7()
> {
> Form1 this2watch = new Form1();
> string addwatch = this.textBox7.Text;<<<Nothing is in here!
> Class1.watCHTimer1 = Convert.ToInt16(addwatch);
> }
>
> thanks in advance,
> Trint
>
>
>
> Thanks,
> Trint
>


Nov 17 '05 #7

P: n/a
Hi Trinit,
Just by creating a form it does not show it in the screen, unless you call
Show() on it.

You are creating a new instance of Form1:

public static void testwatcher()
{
Form1 finDWatchInt = new Form1();

so this instance is not being displayed in the screen, unless you call Show
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"trint" <tr***********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Ignacio,
I can't do a "finDWatchInt.ShowDialog(); because the Form1 is already
showing (Form1 would then appear twice???). This happens as a result
of this button click:

public void button19_Click(object sender, System.EventArgs e)
{
Class1.testwatcher();
}
Thanks,
Trint
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

There are a number of thing I do not get from your code,

Why testwatcher is static?

You are not even showing the form in the first place, how do you

expect it
to have a value?

Form1 finDWatchInt = new Form1();
do
{
finDWatchInt.ShowDialog(); // ********* include this line
finDWatchInt.getTextBox7(); <<This is the call.
watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
MessageBox.Show("Please enter a number value!");
}
while(watCHTimer1 < 1);
}

still I do not understand what you are trying to do.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
> Ok,
> This is where it is called:
>
>>From Class1.cs:
>
> public static void testwatcher()
> {
> Form1 finDWatchInt = new Form1();
> do
> {
> finDWatchInt.getTextBox7(); <<This is the call.
> watCHTimer1 = Convert.ToInt16(finDWatchInt.textBox6.Text);
> MessageBox.Show("Please enter a number value!");
> }
> while(watCHTimer1 < 1);
> }
>
> Thanks,
> Trint
>
> Ignacio Machin ( .NET/ C# MVP ) wrote:
>> Hi,
>>
>> Who/ Where call getTextBox7() ?
>>
>> do you mean that even if you type something in you do not see it on > the
>> screen?
>>
>> Please give more details
>>
>> cheers,
>>
>> --
>> Ignacio Machin,
>> ignacio.machin AT dot.state.fl.us
>> Florida Department Of Transportation
>>
>> "trint" <tr***********@gmail.com> wrote in message
>> news:11*********************@z14g2000cwz.googlegro ups.com...
>> >I have a textbox (textBox7) that isn't updating..
>> > Is there a way, after I type new text in it, to have it update?
>> > It seems to be fairly normal:
>> >
>> > public class Form1
>> > : System.Windows.Forms.Form
>> > {
>> > private System.Windows.Forms.TextBox textBox7;
>> > .....
>> > private void InitializeComponent()
>> > {
>> > this.textBox7 = new System.Windows.Forms.TextBox();
>> >
>> > // textBox7
>> > //
>> > this.textBox7.Location = new System.Drawing.Point(248, 32);
>> > this.textBox7.Name = "textBox7";
>> > this.textBox7.Size = new System.Drawing.Size(72, 20);
>> > this.textBox7.TabIndex = 69;
>> > this.textBox7.Text = "";
>> > //
>> > this.Controls.Add(this.textBox7);
>> >
>> >
>> > Ok, the Form1 is idol and I type "100".
>> >
>> > then debug and watch here:
>> > public void getTextBox7()
>> > {
>> > Form1 this2watch = new Form1();
>> > string addwatch = this.textBox7.Text;<<<Nothing is in here!
>> > Class1.watCHTimer1 = Convert.ToInt16(addwatch);
>> > }
>> >
>> > thanks in advance,
>> > Trint
>> >
>> >
>> >
>> > Thanks,
>> > Trint
>> >
>

Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.