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

can't see passed value to textbox in another form (C#)

Hi guys,

I have one easy question for you.

I have class with public static variable. I enter value in one form (in this public static variable) and when I passed it to another form in textbox I can't see the value until I try to write something in this textbox and then the value it self is locked and can't be changed.
In mentioned textbox I'm using following code:

textBoxExample.Text = Class1.variable1;

what I'm doing wrong?

thanks for help
Sep 3 '08 #1
3 2047
Curtis Rutland
3,256 Expert 2GB
I'm not sure what you are trying to do...are you trying to set a static value from an instanced form? That doesn't make sense to me.

Please post more of your code so we can see what you are aiming for.
Sep 3 '08 #2
PRR
750 Expert 512MB
Hi guys,

I have one easy question for you.

I have class with public static variable. I enter value in one form (in this public static variable) and when I passed it to another form in textbox I can't see the value until I try to write something in this textbox and then the value it self is locked and can't be changed.
In mentioned textbox I'm using following code:

textBoxExample.Text = Class1.variable1;

what I'm doing wrong?

thanks for help
Its pretty simple...

Declare form 2 object in form1:

Form2 f2;

// On some button click
private void button1_Click(object sender, EventArgs e)
{
Class1.ss = textBox1.Text;

f2 = new Form2();
f2.Show();
}


//The Class that will have static field
public class Class1
{
public static string ss=null;

}

////////
//on Form 2 load:

if (Class1.ss != null)
{
textBox1.Text = Class1.ss;
}

If this is wat u intend to do.....
Sep 4 '08 #3
I explained it badly because I'm beginner, but dirbag understood me perfectly and this is exactly what I needed. It works. Thank you
Sep 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
26
by: Paul | last post by:
public class A { public A () { // here I would like to call the second version of _ctor, how to accomplish this ? } public A (int a, int b, int c) {
2
by: ABC | last post by:
How to pre-set combo textbox's selectedindex value from querystring passed from another page? I pass the querystring to set combo text box (change selectedindex on Page_Init). Source code as: ...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
10
by: Miro | last post by:
I wanted certain text boxes ( only certain ones ) to always be Trim'd so that spaces are not in the begining, nor the end of the text entered. I created my own "Handle ?" - i hope thats the...
8
by: Henry Jones | last post by:
Using VB.NET 2005. I have a Function that I would like to pass the form name and the textbox name to. ----------------------------------------- Function DoSomeThing(byref frmOBJ as Object,...
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
10
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.