Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. hi!! [modified]

hi!! [modified]

Scheduled Pinned Locked Moved C#
helpdatabasecom
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nekshan
    wrote on last edited by
    #1

    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

    V C G 4 Replies Last reply
    0
    • N Nekshan

      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

      V Offline
      V Offline
      virendra patel
      wrote on last edited by
      #2

      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..

      N 2 Replies Last reply
      0
      • N Nekshan

        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

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        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

        N 1 Reply Last reply
        0
        • V virendra patel

          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..

          N Offline
          N Offline
          Nekshan
          wrote on last edited by
          #4

          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.

          V 1 Reply Last reply
          0
          • C Colin Angus Mackay

            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

            N Offline
            N Offline
            Nekshan
            wrote on last edited by
            #5

            yes i did, But i m getting errors and its still not working. :-( Still trying.

            1 Reply Last reply
            0
            • V virendra patel

              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..

              N Offline
              N Offline
              Nekshan
              wrote on last edited by
              #6

              i m gng now i'll chek 2mrw. thanx. Sorry for disturbing you soo much. Nekshan.

              1 Reply Last reply
              0
              • N Nekshan

                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.

                V Offline
                V Offline
                virendra patel
                wrote on last edited by
                #7

                ' ok i will send u code.

                1 Reply Last reply
                0
                • N Nekshan

                  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

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  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;

                  1 Reply Last reply
                  0
                  • N Nekshan

                    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

                    V Offline
                    V Offline
                    virendra patel
                    wrote on last edited by
                    #9

                    ' 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.

                    N 1 Reply Last reply
                    0
                    • V virendra patel

                      ' 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.

                      N Offline
                      N Offline
                      Nekshan
                      wrote on last edited by
                      #10

                      Happy B'day!! :-) Form2 is execute first,its a login form. After 'login' a 'grid form' opens,it has a logout button, on logout that datetime value must go in a table. Thanx. Take care Enjoy d day!! nekshan.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups