hi!! [modified]
-
hi!! i had been refering to article 'passing values betn forms'. I tried from it, but still i cant pass my variable from form1 to form2. I m getting error on passing my variable to the other form's variable. i have used the object approach from that article : http://www.codeproject.com/useritems/pass\_data\_between\_forms.asp Objects of forms are created properly. This i have written in form1 : p = ((form1)log).n; // log is object of form2. //variable 'n' i have to bring from form2,which contains a date from query fired. but i m getting error : 'Object reference not set to an instance of an object.' It would be v.nice if u could help on it. Thanx. -- modified at 6:22 Wednesday 21st February, 2007
-
hi!! i had been refering to article 'passing values betn forms'. I tried from it, but still i cant pass my variable from form1 to form2. I m getting error on passing my variable to the other form's variable. i have used the object approach from that article : http://www.codeproject.com/useritems/pass\_data\_between\_forms.asp Objects of forms are created properly. This i have written in form1 : p = ((form1)log).n; // log is object of form2. //variable 'n' i have to bring from form2,which contains a date from query fired. but i m getting error : 'Object reference not set to an instance of an object.' It would be v.nice if u could help on it. Thanx. -- modified at 6:22 Wednesday 21st February, 2007
best way is write query on that form for getting date from database. the code i sent is correct but this i checked on vb.net. if possible i will send code again.bye..
-
hi!! i had been refering to article 'passing values betn forms'. I tried from it, but still i cant pass my variable from form1 to form2. I m getting error on passing my variable to the other form's variable. i have used the object approach from that article : http://www.codeproject.com/useritems/pass\_data\_between\_forms.asp Objects of forms are created properly. This i have written in form1 : p = ((form1)log).n; // log is object of form2. //variable 'n' i have to bring from form2,which contains a date from query fired. but i m getting error : 'Object reference not set to an instance of an object.' It would be v.nice if u could help on it. Thanx. -- modified at 6:22 Wednesday 21st February, 2007
Have you read this other article on passing values between forms[^]
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
-
best way is write query on that form for getting date from database. the code i sent is correct but this i checked on vb.net. if possible i will send code again.bye..
If u have time, till 2mrw eve. whenever u have time, just try it, i have done this: This is in FORM1 : public partial class detail_form : Form { public DateTime n; ....... ( ... this means other not related coding is done here.) } private void button1_Click(object sender, EventArgs e) { conn.Open(); string strQury = ""; strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")'"; SqlCommand cm = new SqlCommand(strQury, conn); n = Convert.ToDateTime(cm.ExecuteScalar()); conn.close(); } In FORM2 : public partial class login : Form { DateTime p; ......... } private void login1_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); conn.Open(); cmd.Connection = conn; ...... p = ((detail_form)log).n; ......... } I have to use this 'p' in FORM2 function : public void funEntrylogin(int strlogid, int strdashid, string strname, string strpwd, DateTime logindate, DateTime logoutdate) in place of 'logoutdate'. This is my full code. Plz chek n try it wen u have time,i'll wait. Thanx Nekshan.
-
Have you read this other article on passing values between forms[^]
Upcoming events: * Glasgow: Geek Dinner (5th March) * Edinburgh: Web Security Conference Day for Windows Developers (12th April) My: Website | Blog | Photos
-
best way is write query on that form for getting date from database. the code i sent is correct but this i checked on vb.net. if possible i will send code again.bye..
-
If u have time, till 2mrw eve. whenever u have time, just try it, i have done this: This is in FORM1 : public partial class detail_form : Form { public DateTime n; ....... ( ... this means other not related coding is done here.) } private void button1_Click(object sender, EventArgs e) { conn.Open(); string strQury = ""; strQury = "insert into dashboarddealerlogin (logoutdatetime) values '(" + DateTime.Now + ")'"; SqlCommand cm = new SqlCommand(strQury, conn); n = Convert.ToDateTime(cm.ExecuteScalar()); conn.close(); } In FORM2 : public partial class login : Form { DateTime p; ......... } private void login1_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); conn.Open(); cmd.Connection = conn; ...... p = ((detail_form)log).n; ......... } I have to use this 'p' in FORM2 function : public void funEntrylogin(int strlogid, int strdashid, string strname, string strpwd, DateTime logindate, DateTime logoutdate) in place of 'logoutdate'. This is my full code. Plz chek n try it wen u have time,i'll wait. Thanx Nekshan.
' ok i will send u code.
-
hi!! i had been refering to article 'passing values betn forms'. I tried from it, but still i cant pass my variable from form1 to form2. I m getting error on passing my variable to the other form's variable. i have used the object approach from that article : http://www.codeproject.com/useritems/pass\_data\_between\_forms.asp Objects of forms are created properly. This i have written in form1 : p = ((form1)log).n; // log is object of form2. //variable 'n' i have to bring from form2,which contains a date from query fired. but i m getting error : 'Object reference not set to an instance of an object.' It would be v.nice if u could help on it. Thanx. -- modified at 6:22 Wednesday 21st February, 2007
Why do you keep creating new threads about the same question all the time? I have already explained exactly why your code is not working. I have also told you before that I already have explained why your code is not working. Would you please read my reply before creating any more threads about this?
--- single minded; short sighted; long gone;
-
hi!! i had been refering to article 'passing values betn forms'. I tried from it, but still i cant pass my variable from form1 to form2. I m getting error on passing my variable to the other form's variable. i have used the object approach from that article : http://www.codeproject.com/useritems/pass\_data\_between\_forms.asp Objects of forms are created properly. This i have written in form1 : p = ((form1)log).n; // log is object of form2. //variable 'n' i have to bring from form2,which contains a date from query fired. but i m getting error : 'Object reference not set to an instance of an object.' It would be v.nice if u could help on it. Thanx. -- modified at 6:22 Wednesday 21st February, 2007
' i don't know which form is execute first ' what u do temperory ' first the form which is execute first write , first insert the values in database by using insert into tablename .... like wise. ' the information which u have only send in that function and leave it blank other field right. eg. insert into user (userid,password) values('viru_dram','hello') ' then in other form update the inserted value in database using eg.update tablename set timeout = system.datetime.now where userid='viru_dream' .... 'get it?. i will send u solution withing 2 days ok.bye.
-
' i don't know which form is execute first ' what u do temperory ' first the form which is execute first write , first insert the values in database by using insert into tablename .... like wise. ' the information which u have only send in that function and leave it blank other field right. eg. insert into user (userid,password) values('viru_dram','hello') ' then in other form update the inserted value in database using eg.update tablename set timeout = system.datetime.now where userid='viru_dream' .... 'get it?. i will send u solution withing 2 days ok.bye.