C# Tutorial 55: Passing a value from one form to another form in C#

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 76

  • @davidramirez2415
    @davidramirez2415 4 ปีที่แล้ว +1

    Not sure if you are still active man, but you explained this better than 100 youtube videos I watched before reaching yours, thank you!!!!

  • @srancsik
    @srancsik 11 ปีที่แล้ว +3

    No matter what others say, this helped me out. Thank you!

  • @warriorislive9649
    @warriorislive9649 5 ปีที่แล้ว +3

    Thank You man! Your tutorial made my day. I have been searching for this all around.

  • @abdelkiki
    @abdelkiki 4 ปีที่แล้ว

    Thank you for this video

  • @richardalasdairdenton254
    @richardalasdairdenton254 10 ปีที่แล้ว

    Jokuc - you need to first set the variable for setInput. If you load form2 without first loading form1 and passing the value through you will get an error as the form now requires setInput in order to load

    • @markanthonybulaon4113
      @markanthonybulaon4113 10 ปีที่แล้ว

      what am i supposed to put in the constructor of Form1? im having a hard time though >.

  • @minukaasel
    @minukaasel 10 ปีที่แล้ว +1

    WOW!! Working like a charm!! :) THANKS!

  • @sherinevanbergen7783
    @sherinevanbergen7783 11 ปีที่แล้ว

    This helped me with something I've been struggling with for 3 days. Thank you!!

  • @bananaramaman9031
    @bananaramaman9031 2 ปีที่แล้ว

    Thank you very much

  • @didoma73
    @didoma73 11 ปีที่แล้ว +2

    How do I pass more than one string value to another form? So send data from two different textboxes to another form.

  • @sreejithnair7582
    @sreejithnair7582 3 ปีที่แล้ว

    Form1(login)>>passed to form2(Main Dashboard)>>Form3>>returns to Form2 [the value passed from 1 is not available]

  • @Diana66723
    @Diana66723 6 ปีที่แล้ว

    very nice well explained video ..i want to know how to make reports in c#

  • @jericogarcia3593
    @jericogarcia3593 3 ปีที่แล้ว

    Thanks bro

  • @yashkumarjain6418
    @yashkumarjain6418 4 ปีที่แล้ว

    please make vedios of unit test cases for Windows form in C#

  • @csongornagy2452
    @csongornagy2452 4 ปีที่แล้ว

    Thanks!

  • @anupviral90
    @anupviral90 10 ปีที่แล้ว +3

    What if i want to pass some data back to form1 one from form2?? can u please guide me??

  • @vihangajuly6316
    @vihangajuly6316 4 ปีที่แล้ว

    thanks sir

  • @عبدالغنيالقليسي
    @عبدالغنيالقليسي 3 ปีที่แล้ว

    Plz show me how i can keep the frm without changing it.s boarder like unruntime plz

  • @helenamakarchuk4104
    @helenamakarchuk4104 8 ปีที่แล้ว +1

    Thank you!!!

  • @samisaidi1356
    @samisaidi1356 4 ปีที่แล้ว

    Helllo Juste a little point your r using the same name of text Box1 in tow Forms So I can t difference between them

  • @jokuc3669
    @jokuc3669 10 ปีที่แล้ว +1

    I do exactly like you do but I get the error
    "'Project.Form2' does not contain a constructor that takes 0 arguments"
    Even though I put
    private void btnApply_Click(object sender, EventArgs e)
    {
    Form2 Form2Instance = new Form2(tbxTextInput.Text);
    Form2Instance.Show();
    }
    in form1 and
    public Form2(string setInput)
    {
    InitializeComponent();
    lblScroll.Text = setInput;
    }
    in form2

  • @федов-ф4х
    @федов-ф4х 7 ปีที่แล้ว

    //for functions from another forms
    Main_Form main_form = this.Owner as Main_Form;
    main_form.FUNCTION_FROM_MAIN_FORM
    //for data from another forms
    Main_From.VAR_From_Main_Form -->all VARs should be public static

  • @انامسلموكفى
    @انامسلموكفى 3 ปีที่แล้ว

    Thank you so much ! i ve a qeustion concerning a combobox : I' ve a ComboBox with Three Items in main Form and a button make another form.show so in the second form i am asking about the selected item in the combox and switch it in 3 cases but i ve an error said nullReference the item is null even i select one item from the Combox ( "Tete", "Doublette", "Triplette")
    Thank you for Your Help

  • @andyRagniya
    @andyRagniya 5 ปีที่แล้ว

    I have been trying for a lot of days in which I can create a media player, also get the file path and file name from the database and then play it also you can help me in fullscreen

  • @rtlampwork
    @rtlampwork 5 ปีที่แล้ว +2

    Please, please, stop moving the cursor so much. I had to close my eyes and just listen. Otherwise very useful, detailed and clearly presented information.

  • @erovaruis7716
    @erovaruis7716 11 ปีที่แล้ว

    can you make a video tutorial abt this ??? personnally this this tutorial helps me a lot still if you said there is a better way i really wish to know it please

  • @44D3N
    @44D3N 2 ปีที่แล้ว

    How would I do this but with checkboxes, like say topmost

  • @yuriko1890
    @yuriko1890 8 ปีที่แล้ว +5

    Thank you for this...
    BUT what if i want to pass multiple data from one form to another>>>>????
    HELP PLEASE

    • @yuriko1890
      @yuriko1890 8 ปีที่แล้ว +2

      Richard Evans
      i have found another way... this is a login application...
      so i get the value of the username and password... with the use of MYSQL database ..try this
      FORM1
      //at login button i include this MessageBox.Show("Log In Successful!!!");
      this.Hide();
      checkup c = new checkup();
      c.user = name_tb.Text;
      c.pass = pass_tb.Text;
      c.ShowDialog();
      FORM2
      private string Nm;
      private string su;
      public string pass
      {
      get { return su; }
      set { su = value; }
      }
      public string user
      {
      get { return Nm; }
      set { Nm = value; }
      }
      private void checkup_Load(object sender, EventArgs e)
      {
      name_tb.Text = Nm;
      sur_tb.Text = su;
      string MyConnection = "datasource=localhost; port = 3306;username=root;password=Yuri";
      string Query = "select * from data.info where first= '"+ this.name_tb.Text + "' and sur= '"+ this.sur_tb.Text +"' ;";
      i forgot from what tutorial i was able to get this.. ^_^
      GL

    • @faixalnazir6593
      @faixalnazir6593 7 ปีที่แล้ว +1

      its right

    • @jasonliadi8238
      @jasonliadi8238 5 ปีที่แล้ว

      @@yuriko1890 what to insert if I want to add a back button in form2 to form1?

  • @thechromaknight3449
    @thechromaknight3449 5 ปีที่แล้ว

    Thank you :D It took me so long to actually realize how simply it was

  • @markanthonybulaon4113
    @markanthonybulaon4113 10 ปีที่แล้ว

    i have the same problem from the comment below, what am i supposed to do with the "Constructor"?

  • @MrPirinf
    @MrPirinf 8 ปีที่แล้ว

    can i use a form for two fonctions ????
    i mean for exemple :
    if i click on the button add or button show take me to the second form but when i click Button add the second form will save informations
    and when i click Buttonshow the second form will show informations

  • @Dh4m13l
    @Dh4m13l 8 ปีที่แล้ว

    Thank you.

  • @longpheap9592
    @longpheap9592 6 ปีที่แล้ว

    What if i want to pass 3 or 4 value?? Add 4 parameters?

  • @bicycleninja1685
    @bicycleninja1685 6 ปีที่แล้ว

    Thank you!

  • @kushal800
    @kushal800 7 ปีที่แล้ว

    you just passed username what if based on username and pasword it retrieves rest of information like name etc in other form textboxes

  • @zumrudaliyeva241
    @zumrudaliyeva241 5 ปีที่แล้ว

    Thanks a loooot

  • @MoodFaka
    @MoodFaka 8 ปีที่แล้ว

    thank you very much.

  • @riiseborn
    @riiseborn 10 ปีที่แล้ว

    how about passing data from one form to database?

  • @Jedli7
    @Jedli7 8 ปีที่แล้ว

    I'm trying to pass all items from a listbox (or list, idc) to the second form.. any suggestions?

  • @taffyjones1642
    @taffyjones1642 8 ปีที่แล้ว

    Am I the only one that thinks that the example works in the opposite way that he says it should work? at 2:09, he said whatever value he entered in Form2 will pop up in Form 1 after clicking the button; however, when he clicked, it sends the information from Form 1 to Form 2 instead. This got me confused at first because I couldn't understand why he was declaring a variable in the Form 2 method that would be accepting the text rather than sending the text.

    • @aaroncookerly5766
      @aaroncookerly5766 7 ปีที่แล้ว

      Yeah I had to completely start over because of it.

  • @Sinnfullworld
    @Sinnfullworld 4 ปีที่แล้ว

    What is your name Brother?

  • @ThePokemaniac77
    @ThePokemaniac77 7 ปีที่แล้ว

    i've done it's working but now i cant switch forms without the login popping out again...

  • @iownzelda
    @iownzelda 11 ปีที่แล้ว

    great job!

  • @nitzsantillan1653
    @nitzsantillan1653 4 ปีที่แล้ว

    Pls help me how to do it with wamp server.

  • @jasonliadi8238
    @jasonliadi8238 5 ปีที่แล้ว

    what to insert if I want to add a back button in form2 to form1?

    • @jasonliadi8238
      @jasonliadi8238 5 ปีที่แล้ว

      this.Hide();
      Mainmenu mm = new MainMenu(); // I GOT ERROR IN HERE //
      mm.ShowDialog();

  • @143rober
    @143rober 9 ปีที่แล้ว

    Thanks that helps alot
    \

  • @JasonRobards2
    @JasonRobards2 4 ปีที่แล้ว

    The zoom combined with the scrolling about makes this more difficult to follow than it could be.

  • @umarahmedsheikh6828
    @umarahmedsheikh6828 5 ปีที่แล้ว

    Sir! Please tell me how to pass many values from one form to another form

  • @loukask.9111
    @loukask.9111 8 ปีที่แล้ว

    best video quality... 360p

  • @1997gale
    @1997gale 6 ปีที่แล้ว

    Thank you a lot!

  • @ayyazishaque3773
    @ayyazishaque3773 7 ปีที่แล้ว

    anyone can tell me how to same template design on other form class???

  • @emzbllrs
    @emzbllrs 6 ปีที่แล้ว

    too clumsy.

  • @Mantux105
    @Mantux105 8 ปีที่แล้ว

    nebesvaik

  • @Mio2k10
    @Mio2k10 11 ปีที่แล้ว

    Do not keep this tutorial in mind. It is really bad. Use events to pass data between 2 forms.

  • @aaroncookerly5766
    @aaroncookerly5766 7 ปีที่แล้ว

    You completely fucked my program by mixing up which form was receiving the value. I had to start over from scratch. Thanks.

  • @lucashallo4760
    @lucashallo4760 5 ปีที่แล้ว

    f

  • @itcloudguy
    @itcloudguy 6 ปีที่แล้ว

    The content is very helpful and I was need to watch this video. But rotating your cursor drives me crazy. I was diverting my eyes to another side not to see it but... I need to see what u`re doing there. Sorry. But for me it`s impossible to watch all your videos. They`re too annoying...

  • @izanefamir3982
    @izanefamir3982 5 ปีที่แล้ว

    gooooooooooo toooooooooo arrrrrrrrrrrrrrrrrrr what the fuck***

  • @FacePalmProduxtnsFPP
    @FacePalmProduxtnsFPP 6 ปีที่แล้ว

    You talk so slow

    • @kenmtb
      @kenmtb 6 ปีที่แล้ว

      if the video is too slow or fast you can adjust the video speed. Lower right screen, click the gear...

  • @sonaligaikwad2335
    @sonaligaikwad2335 4 ปีที่แล้ว

    Thank you so much...

  • @evancito2
    @evancito2 7 ปีที่แล้ว

    thanks a lot!