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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. help me solve this problem ? please ...

help me solve this problem ? please ...

Scheduled Pinned Locked Moved C#
helpquestiondesignjson
5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    hi all, i have a function like this in my form1.cs: public void SendAll(string str) { for (int i = 0; i < Soketler.Count; ++i) { if (((Socket)Soketler[i]).Connected) { ns = new NetworkStream(((Socket)Soketler[i])); sw = new StreamWriter(ns); sw.WriteLine(str); string[] dataread = new string[3]; char[] splitter = { ' ' }; dataread = str.Split(splitter); txtOdaNo.Text = dataread[0].ToString(); txtKiraBaslangic.Text = dataread[1].ToString(); txtKiraBitis.Text = dataread[2].ToString(); cmbCOSaati.Text = "12:00"; button12_Click(sender, e); MessageBox.Show("Kiralama Kodunuz!!!\n\n Ciktisini Almak Ister Misiniz ?"," Kira Kodu Bilgisi",MessageBoxButtons.YesNo,MessageBoxIcon.Information); sw.Flush(); } } } bold line represent a button on my form. i have a user interface and some textboxes. these boxes may be filled both manually by typing from keyboard or they can be send via tcp/ip as a string with " " (a space) in each data. then i parse the string according to that space and assign each value to the corresponding textboxes. the problem is this: if user fill datas manually, s/he can easily press the button12 to run it. but if datas were send via tcp/ip and textboxes filled by parsing, button12_click(sender,e); doesnt work in my function :( i get these errors: > the name 'sender' does not exist in the current context. > the name 'e' does not exist in the current context. how can i solve this problem and make button12_click work in my function as well ? help please, thanks in advance, bye.

    S J 2 Replies Last reply
    0
    • L Lost User

      hi all, i have a function like this in my form1.cs: public void SendAll(string str) { for (int i = 0; i < Soketler.Count; ++i) { if (((Socket)Soketler[i]).Connected) { ns = new NetworkStream(((Socket)Soketler[i])); sw = new StreamWriter(ns); sw.WriteLine(str); string[] dataread = new string[3]; char[] splitter = { ' ' }; dataread = str.Split(splitter); txtOdaNo.Text = dataread[0].ToString(); txtKiraBaslangic.Text = dataread[1].ToString(); txtKiraBitis.Text = dataread[2].ToString(); cmbCOSaati.Text = "12:00"; button12_Click(sender, e); MessageBox.Show("Kiralama Kodunuz!!!\n\n Ciktisini Almak Ister Misiniz ?"," Kira Kodu Bilgisi",MessageBoxButtons.YesNo,MessageBoxIcon.Information); sw.Flush(); } } } bold line represent a button on my form. i have a user interface and some textboxes. these boxes may be filled both manually by typing from keyboard or they can be send via tcp/ip as a string with " " (a space) in each data. then i parse the string according to that space and assign each value to the corresponding textboxes. the problem is this: if user fill datas manually, s/he can easily press the button12 to run it. but if datas were send via tcp/ip and textboxes filled by parsing, button12_click(sender,e); doesnt work in my function :( i get these errors: > the name 'sender' does not exist in the current context. > the name 'e' does not exist in the current context. how can i solve this problem and make button12_click work in my function as well ? help please, thanks in advance, bye.

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      The following should work:

      button12_Click(this.button12, new EventArgs());


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      L W 2 Replies Last reply
      0
      • S Stefan Troschuetz

        The following should work:

        button12_Click(this.button12, new EventArgs());


        "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

        www.troschuetz.de

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        done, thanks ;)

        1 Reply Last reply
        0
        • L Lost User

          hi all, i have a function like this in my form1.cs: public void SendAll(string str) { for (int i = 0; i < Soketler.Count; ++i) { if (((Socket)Soketler[i]).Connected) { ns = new NetworkStream(((Socket)Soketler[i])); sw = new StreamWriter(ns); sw.WriteLine(str); string[] dataread = new string[3]; char[] splitter = { ' ' }; dataread = str.Split(splitter); txtOdaNo.Text = dataread[0].ToString(); txtKiraBaslangic.Text = dataread[1].ToString(); txtKiraBitis.Text = dataread[2].ToString(); cmbCOSaati.Text = "12:00"; button12_Click(sender, e); MessageBox.Show("Kiralama Kodunuz!!!\n\n Ciktisini Almak Ister Misiniz ?"," Kira Kodu Bilgisi",MessageBoxButtons.YesNo,MessageBoxIcon.Information); sw.Flush(); } } } bold line represent a button on my form. i have a user interface and some textboxes. these boxes may be filled both manually by typing from keyboard or they can be send via tcp/ip as a string with " " (a space) in each data. then i parse the string according to that space and assign each value to the corresponding textboxes. the problem is this: if user fill datas manually, s/he can easily press the button12 to run it. but if datas were send via tcp/ip and textboxes filled by parsing, button12_click(sender,e); doesnt work in my function :( i get these errors: > the name 'sender' does not exist in the current context. > the name 'e' does not exist in the current context. how can i solve this problem and make button12_click work in my function as well ? help please, thanks in advance, bye.

          J Offline
          J Offline
          J4amieC
          wrote on last edited by
          #4

          button12.PerformClick(); Current blacklist svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour

          1 Reply Last reply
          0
          • S Stefan Troschuetz

            The following should work:

            button12_Click(this.button12, new EventArgs());


            "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

            www.troschuetz.de

            W Offline
            W Offline
            W Kleinschmit
            wrote on last edited by
            #5

            Even better:

            button12_Click(this.button12, EventArgs.Empty);

            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