473,327 Members | 2,016 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.

problem with 2 forms and 1 textbox

hi @ all,

i have a little problem...
i have 2 forms (form1 and form2)

on form1 threre is a textbox TB1 and a button BT1
by clicking on BT1 i switch to form2

so now the problem:
in TB1 is a text which i want to give out via a messagebox on form2... but form2 don't know about the TB1... also when i save the content of TB1 in a string at form1 an switch to form2 the string don't be known

could anybody help me?

PS: sorry about the teriible english, i hope you can understand it ^^
thanks
Sep 4 '07 #1
4 815
hi,
assume you have a value in TB1 in form1
on BT1 click event carry that TB1 value in the session like

void BT1_click(sender,e)
{
session["TB1value"]=TB1.text;
}


in form2 page load event

pageload
{
show("session["TB1value"].Tostring()");
}
function for show.
public static void Show( string sMessage )
{
if( !m_executingPages.Contains( HttpContext.Current.Handler ) )
{
Page executingPage = HttpContext.Current.Handler as Page;
if( executingPage != null )
{
Queue messageQueue = new Queue();
messageQueue.Enqueue( sMessage );
m_executingPages.Add( HttpContext.Current.Handler, messageQueue );
executingPage.Unload += new EventHandler( ExecutingPage_Unload );
}
}
else
{
Queue queue = (Queue) m_executingPages[HttpContext.Current.Handler ];

queue.Enqueue( sMessage );
}
}

hope this may help
hi @ all,

i have a little problem...
i have 2 forms (form1 and form2)

on form1 threre is a textbox TB1 and a button BT1
by clicking on BT1 i switch to form2

so now the problem:
in TB1 is a text which i want to give out via a messagebox on form2... but form2 don't know about the TB1... also when i save the content of TB1 in a string at form1 an switch to form2 the string don't be known

could anybody help me?

PS: sorry about the teriible english, i hope you can understand it ^^
thanks
Sep 4 '07 #2
if it is a web application then use a query string or you can use session also
Rohit Jain
Sep 4 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
And if its not a web aplication
send form1 as a parameter to form2
and access
Expand|Select|Wrap|Line Numbers
  1. TB1 using form1.TB1.Text;
Sep 4 '07 #4
jo thanks,
i've found also a solution...

it's a little bit easier ^^

form1:
private void button1_Click(object sender, System.EventArgs e)
{
Form2 frm=new Form2(textBox1.Text);
frm.Show();
}

form2:
public Form2(string strTextBox)
{
InitializeComponent();
label1.Text=strTextBox;
}


now, i see, that i forgot to say, that i am programming in c# .net, but it's no problem, thx for your solution
Sep 4 '07 #5

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

Similar topics

0
by: Mike Burkhart | last post by:
I have written the following class to build a data grid textbox column that has the KeyUp and KeyPress events defined for the TextBox. I also defined the KeyDown event for testing purposes only. ...
1
by: Saper\(ek\) | last post by:
I need to encrypt some data in my program, so I've created 2 functions to encrypt and decrypt data. I've created a simple program to test it, and... it crashes. It wors ok on XP, but on win98 it...
2
by: Tim Frawley | last post by:
Source code attached indicates my problem with validation and a button bar save button. Fill the Textbox with some text then tab off the control. The message box will display the text in the...
0
by: Bruin | last post by:
Hi All, I'm having a problem with MDI child forms when the reference to the MDI Parent is set in a Control library. (Sorry for the long post) I have an control library assembly which holds all...
6
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
3
by: Gerrit | last post by:
Hi, I try to learn programming in c# with databinding controls. Now I have a problem with a ComboBox with the advanced properties for databinding, I want to set the DataSourceUpdateMode to...
1
by: romcab | last post by:
Hi guys, I would like to ask your help about saving in ado.net. I was able to update it only on the display but when I check the database, it is not updated. I paste below my code and hopefully...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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.