BEST Way to SEND DATA between Multiple Forms | C# Windows Form

  Рет қаралды 182,208

The Amazing Codeverse

The Amazing Codeverse

Күн бұрын

Пікірлер
@HassaanRaza
@HassaanRaza Жыл бұрын
CHECK THIS OUT! How to Buy Website Domain & Hosting, Complete Simple Procedure kzbin.info/www/bejne/l16WhnmqZteSZ6s
@ricklangston8895
@ricklangston8895 3 жыл бұрын
I just went through this two or three times and it feels like I just learned in six minutes what would've taken six weeks to learn from other "dry" tutorials. Again, good job.
@HassaanRaza
@HassaanRaza 3 жыл бұрын
thanks man! thank you so much your appreciation inspire us creators to do more 😁
@konichiwaya2448
@konichiwaya2448 3 жыл бұрын
this just answered 5 pages of modules, I've been fixing my project for 2 weeks! THANK YOU SO MUCH!!!
@HassaanRaza
@HassaanRaza 3 жыл бұрын
thats is super awesome to know! best of luck with you project.
@viniciusmachadovianna
@viniciusmachadovianna Жыл бұрын
This helped me with an issue I was facing about one whole week. I'm immensely grateful for this content, many blessings for you!
@HassaanRaza
@HassaanRaza Жыл бұрын
thanks mate, keep going. good luck with whatever you are making :)
@warzonerustproject7227
@warzonerustproject7227 3 жыл бұрын
I went through a lot of videos, not one did not work, I saw yours, checked it and immediately worked, thank you very much, you helped a lot
@HassaanRaza
@HassaanRaza 3 жыл бұрын
that's great!
@sumaidch1124
@sumaidch1124 3 ай бұрын
Man, You made my Day
@mohamedhussein9679
@mohamedhussein9679 3 жыл бұрын
THIS IS THE BEST!!! THANK YOU 3000! I have been looking for this for over 3 weeks now!
@HassaanRaza
@HassaanRaza 3 жыл бұрын
yup its a little tricky to figure.
@normal.2002
@normal.2002 Жыл бұрын
After 2 years and i am here Thanks you Indian teacher
@HassaanRaza
@HassaanRaza Жыл бұрын
haha that's awesome, cheers! by the way I'm from Pakistan (so not indian)
@normal.2002
@normal.2002 Жыл бұрын
@@HassaanRaza ohh i am so sorry thank you my Pakistan teacher 🥰🥰
@HassaanRaza
@HassaanRaza Жыл бұрын
hehe
@mahersabit9265
@mahersabit9265 2 ай бұрын
how about when i click the button to open the other form the first form disappears or changed.
@zuratchankvetadze6646
@zuratchankvetadze6646 8 ай бұрын
omg.. you help me a lot.. no blackbox no stackover... thank u man
@HassaanRaza
@HassaanRaza 8 ай бұрын
haha im glad i could be of help :)
@janstergaard703
@janstergaard703 Жыл бұрын
I usually have a hard time with Hinglish. But this time it was WELL WORTH it, thanks ! Also slowing the video a bit down helped a little bit ;-)
@BoorgPL
@BoorgPL 2 жыл бұрын
Hi. I have a problem with the example given here. I have a Form object named EDF1 on the form I have public static cmdrName, shipName_z etc. So I have this code in EDF1 form: public static EDF1 instance; public Label cmdrName_z; public Label shipName_z; and instance = this; cmdrName_z = cmdrName; shipName_z = shipName; Then in the second class project file I have a function public void read_file (string changeFile) in which I read the changes that appeared in the file given as "changeFile". If the change is significant, I enter it into the element on the EDF1 form with the code: EDF1.instance.cmdrName_z.Text = newValue The problem is, I get an exception once in a while: "Invalid cross-thread operation: The 'cmdrName' control is being accessed from a thread other than the thread on which it was created." This exception was originally thrown on this call stack: System.Windows.Forms.Control.Handle.get () System.Windows.Forms.Control.WindowText.set (string) System.Windows.Forms.Control.Text.set (string) ED_Informator.Jurnal.read_file (string) in Jurnal.cs ED_Informator.EDF1.OnChanged (object, System.IO.FileSystemEventArgs) in Form1.cs System.IO.FileSystemWatcher.OnChanged (System.IO.FileSystemEventArgs) System.IO.FileSystemWatcher.CompletionStatusChanged (uint, uint, System.Threading.NativeOverlapped *) System.Threading._IOCompletionCallback.PerformIOCompletionCallback (uint, uint, System.Threading.NativeOverlapped *) Same appeal EDF1.instance.cmdrName_z.Text = newValue There are also two other functions, one of which is called to read some information from the most recently created change log file. The second pre-checks the file after creating a new change log file.
@fetrush6383
@fetrush6383 8 ай бұрын
Hi thank you i look for this method over 5 month you saved my life :D
@HassaanRaza
@HassaanRaza 8 ай бұрын
hahaha glad you found me XD
@rk81oman
@rk81oman 11 күн бұрын
Very helpful, thank you Hassaan!
@HassaanRaza
@HassaanRaza 11 күн бұрын
Yo welcome :)
@ricklangston8895
@ricklangston8895 3 жыл бұрын
That was so cool. I've been hacking away at this for over an hour. This video was clear and straight to the point. Thanks. You saved me a lot of time. :D
@HassaanRaza
@HassaanRaza 3 жыл бұрын
that's great to know :)
@trevorloughlin1492
@trevorloughlin1492 3 жыл бұрын
I kept finding programs opening multiple instances of form2 every time I transferred data, but this does exactly what I needed. Since I am using some hardware in combination with advanced mathematical processing to send messages back from the future, you will be first in line for the lottery numbers when everything is up and running. Thank you! I presume I can run a chart control using similar methods? There are so many charts in my program that one form is not enough.
@HassaanRaza
@HassaanRaza 3 жыл бұрын
yes you can, good luck with your worj
@mihailoradovanovic7283
@mihailoradovanovic7283 Жыл бұрын
Ty so much! This helped me with my school work a lot
@HassaanRaza
@HassaanRaza Жыл бұрын
that awesome :)
@dominikweclewski5753
@dominikweclewski5753 3 жыл бұрын
Thank you so much. I looked for this for 5 days.
@HassaanRaza
@HassaanRaza 3 жыл бұрын
thats great to know :)
@thantsintun100
@thantsintun100 4 ай бұрын
Thank you. Very clear and simple.
@tadehack_ctz
@tadehack_ctz Жыл бұрын
I'm not sure if you can help me but whenever I try accessing something from the other form it gives me this exception error: "Object reference not set to an instance of an object." public partial class FormConfig : Form { public static FormConfig instance; public TextBox tbCaminhoCadastros; //Constructor public FormConfig() { InitializeComponent(); instance = this; tbCaminhoCadastros = txtCaminhoCadastros; } } public partial class FormMain : Form { private void wathexSolutions_Load(object sender, EventArgs e) { FormConfig.instance.tbCaminhoCadastros.Text = "test"; } } The exeptions occurs for everything I try to access from "FormConfig" and not just for that textBox, it also happens when I try to access it from the "FormMain" Constructor too, are there anything I'm missing?
@sonr0xz
@sonr0xz Жыл бұрын
same
@OtsileM
@OtsileM Жыл бұрын
The name instance does not exist in current context. Am using a multi document winforms with parent and child forms. Any suggestions?
@picexcelbi_ytb
@picexcelbi_ytb 2 жыл бұрын
If i would like to share information from FORM to FORM2, by in this case. To appear in Datagridview from From2. It´s the same proccess?
@HassaanRaza
@HassaanRaza 2 жыл бұрын
yes, if i remember correctly its the datagrid.datasource which contains you can tranfer it the same way.
@francescosantone1858
@francescosantone1858 2 жыл бұрын
Perfect tutorial 😍... You are saved my project
@HassaanRaza
@HassaanRaza 2 жыл бұрын
thank you :)
@Trexstudio1
@Trexstudio1 2 жыл бұрын
it say this - System.NullReferenceException: 'Object reference not set to an instance of an object.'
@5awaga
@5awaga 4 күн бұрын
Because you should open the form2 dialogue in the same time.
@ThisIsABadIdeaSrsly
@ThisIsABadIdeaSrsly 3 жыл бұрын
I have a question regarding example 2. Let's say I open multiple instances of "Form2" using "button1". If I write something on textbox2 and apply the change pressing "button change form2", will the label in all instances of Form2 change? Or will only the last opened form be affected? After a bit of experimenting, the latter seems to be the case, but I wonder if it's possible to make the change apply to all instances of Form2 instead of just the last one. If you have any ideas I'd like to hear them. In advance, thank you for your time!
@HassaanRaza
@HassaanRaza 3 жыл бұрын
form2.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace databtwforms { public partial class Form2 : Form { //list of all instance of form2 opened by form1 private static List instancesList; public Label lab1; //this constructor run only one time because its static for initialization of list static Form2() { instancesList = new List(); } public Form2() { InitializeComponent(); instancesList.Add(this); lab1 = label1; } private void button1_Click(object sender, EventArgs e) { Form1.instance.tb1.Text = "set by form2"; } //NEWLY CREATED METHOD public static void ChangeAllText(string text) { foreach (var item in instancesList) { item.lab1.Text = text; } } } }
@HassaanRaza
@HassaanRaza 3 жыл бұрын
inside form1: private void button2_Click(object sender, EventArgs e) { //USED THE NEWLY CREATED METHOD Form2.ChangeAllText(textBox2.Text); }
@HassaanRaza
@HassaanRaza 3 жыл бұрын
so bascially each time we are creating a form2 we are storing instance info in a list, and when its time to change textbox we are change all the instances textboxes
@ThisIsABadIdeaSrsly
@ThisIsABadIdeaSrsly 3 жыл бұрын
@@HassaanRaza Yes, this works perfectly for what I've been working on. Huge thanks to you! PS: My mom sends her thanks too!
@HassaanRaza
@HassaanRaza 3 жыл бұрын
hahah remember me in your prayers
@Kamil32-nq6be
@Kamil32-nq6be 4 ай бұрын
Thx man, you really helped me a lot!!
@signaller
@signaller 2 жыл бұрын
Thank you so much i was trying to figure out how to do this!
@RasitTunc15
@RasitTunc15 Жыл бұрын
Thank you my friend, you were very useful
@fitrahazizah7267
@fitrahazizah7267 3 жыл бұрын
How about using com port in multiple windows? can you help me? I have to receive my data from com port in form2 and display it in my main form (form1)
@javasocketexception
@javasocketexception 2 жыл бұрын
How am I supposed to get the form1 app on the add new items? I can't find it
@rashidselemani475
@rashidselemani475 2 жыл бұрын
Thanks sir for this tutorial, you help me a lot
@44D3N
@44D3N Жыл бұрын
Hi, I want to do this but from form1 I want to be able to hide form 2 using a button. So When you press a button on form 1 it will hide form2 something like (form2.Hide();) I have tried lots of ways and none of them are working
@Isamu1013
@Isamu1013 3 жыл бұрын
Hey great Video. I have a question when I create an instance of form 2 in the form 1 click event why can't I access methods/data using that instance name? Form2 newForm2 = new Form2(); string title = newForm2.getTitle; //This doesn't work and says that there is no getTitle function) and in Form2 I have defined public string getTitle() { return titleTextBox.text; } Using your way works perfectly just wonder why.
@HassaanRaza
@HassaanRaza 3 жыл бұрын
it will show up! string title = newForm2.getTitle();
@Isamu1013
@Isamu1013 3 жыл бұрын
@@HassaanRaza I had the () in the code just forget them here. The issue was I mistakenly made it Form newForm2 = new Form2() instead of Form2 newForm2 = new Form2() No idea how that happened.
@burakoranler6655
@burakoranler6655 2 жыл бұрын
thank you for your helpfull videos, hope to see new ones too.
@HassaanRaza
@HassaanRaza 2 жыл бұрын
you're welcome, i am working on some good one that you'll see soon, its just hard for me to make time after work.
@khaibaromari8178
@khaibaromari8178 3 жыл бұрын
That was amazing, save me a lot of time
@nightskyblackx7422
@nightskyblackx7422 3 жыл бұрын
I have a question. When I tried it, there was an error with the Show(). Is there something wrong with it?
@alikemalkulful
@alikemalkulful 2 жыл бұрын
Great Technic, Thank you very much. It saved me a lot of work :)
@HassaanRaza
@HassaanRaza 2 жыл бұрын
thats awesome :)
@semrasanlioglu
@semrasanlioglu 2 жыл бұрын
Using the method in this video, I opened the serial port in form 1 and read the value from the serial port in other forms. But other opened forms do not work simultaneously. What can I do about this situation?
@enginargaming7262
@enginargaming7262 3 жыл бұрын
Hello, I want a picture printed on one form and that picture to appear in the other. How can I?
@sgd1925
@sgd1925 10 ай бұрын
thank you , I need it to my project
@000adrianelpiola000
@000adrianelpiola000 Жыл бұрын
It is rare, but i have a warning about the posibility of being instance a null value. It has zero sense, and it doesn't does any damage, it is a curiosity.
@HassaanRaza
@HassaanRaza Жыл бұрын
don't worry its just a stupid warning from vs2022, if you want to get rid of it use example Form? data type instead of Form
@000adrianelpiola000
@000adrianelpiola000 Жыл бұрын
@@HassaanRaza yes i did, but after this everytime i use the instance the vs says something like the instance can be null. It doesn't matter, the trick works very well.
@timothylennryd2528
@timothylennryd2528 Жыл бұрын
Great help! Thank you for this video! ^^
@HassaanRaza
@HassaanRaza Жыл бұрын
thats great, you're welcome :)
@sabuhiamirov288
@sabuhiamirov288 3 жыл бұрын
Hi i have question. how do send class data between multiple form?
@KaioPatrick
@KaioPatrick 3 жыл бұрын
Awesome, you made it so simple!!!
@manuelcornejo7405
@manuelcornejo7405 2 жыл бұрын
Congratulations.Good job!
@HassaanRaza
@HassaanRaza 2 жыл бұрын
thank you :)
@beelogtv9549
@beelogtv9549 2 жыл бұрын
How to save it in database? Like form1 data will show in form2 data and save it.
@abdulqahar9852
@abdulqahar9852 Жыл бұрын
how to insert and update data in just one button(save) in C# // I need some help
@stepbystep1270
@stepbystep1270 2 жыл бұрын
for combobox instead of textbox how it will coded as puplic
@Cesar_Une
@Cesar_Une 2 жыл бұрын
I wanted to do this same command from a server to client, can you help me?
@DjSashaWaksOfficial
@DjSashaWaksOfficial Жыл бұрын
Great Video - Thank you very much :)
@HassaanRaza
@HassaanRaza Жыл бұрын
you're welcome :)
@chathuskamahanama7606
@chathuskamahanama7606 3 жыл бұрын
Thank you very much 👍👍 very usefull
@Alexandra-jc5wc
@Alexandra-jc5wc 2 жыл бұрын
Is this what we also call "Code to call form"?
@HassaanRaza
@HassaanRaza 2 жыл бұрын
we saving the reference of the form then using it to locate the form that we need to change, don't know if it called by the phrase you wrote.
@Alexandra-jc5wc
@Alexandra-jc5wc 2 жыл бұрын
@@HassaanRaza oh i'm so sorry I thought this is it. I was having a hard time finding something like what I said. Can't even see what is this.
@muhammedareeb1464
@muhammedareeb1464 3 жыл бұрын
You are a life saver man. Thank you!
@kurdishprogramming4698
@kurdishprogramming4698 2 жыл бұрын
Good💐💐💐👌
@PrivacyNProgramming
@PrivacyNProgramming 3 жыл бұрын
help! i want to make an OS and in it, I tried to detect whether a program is closed or minimized so when I tried to make the "public TextBox tb1;" part, I changed it to "public Form calculator" and I tried to do the "tb1 = textbox1;" and it looks like this "calculator = Form.Calculator;" but it doesn't work, could you help? EDIT!!: i just remembered that instead of using the form name(Calculator.cs) for the same form(Calculator.cs), could have just typed in "calculator = this;" rather than "calculator = Form.Calculator;", still good video tho, its explains a lot of stuff i didn't understand
@HassaanRaza
@HassaanRaza 3 жыл бұрын
i didn't understood your comment, its really confusing
@davidkei2114
@davidkei2114 Жыл бұрын
Thanks All of your coding !
@FarhanAli-km5id
@FarhanAli-km5id 3 жыл бұрын
Very nice 👍👍👍
@varishaaslam563
@varishaaslam563 2 жыл бұрын
Can u plz tell how can we close form 1 through form 2
@HassaanRaza
@HassaanRaza 2 жыл бұрын
we'll that's a good question, you will be needing the reference of form 1 in your form 2, you can get the reference by "this" keyword
@ΙΜΜυΝΙΤΥ
@ΙΜΜυΝΙΤΥ Жыл бұрын
how would u do this with only one form active and the other hidden?
@med6402
@med6402 2 жыл бұрын
you saved my life thank you so much
@HassaanRaza
@HassaanRaza 2 жыл бұрын
:) live safely from now on.
@ЧУДОЮДО-к9х
@ЧУДОЮДО-к9х 2 жыл бұрын
Thank you from Kazakhstan
@HassaanRaza
@HassaanRaza 2 жыл бұрын
thanks for commenting brother, im from Paksitan :)
@riverofgolds
@riverofgolds 2 жыл бұрын
How would I do this with radioButtons?
@martinqmtakacs4145
@martinqmtakacs4145 3 жыл бұрын
Thank you this helped me :)
@tetraldinodanatividademart4242
@tetraldinodanatividademart4242 11 ай бұрын
very nice
@기린퇴물임
@기린퇴물임 3 жыл бұрын
oh thank you this video help me to solve my problem
@HassaanRaza
@HassaanRaza 3 жыл бұрын
its great to know!
@scrapylegit4690
@scrapylegit4690 3 жыл бұрын
my problem is for me that i cant figure out how to use a public vector in 2 forms?
@HassaanRaza
@HassaanRaza 3 жыл бұрын
make a new class put a public static vector there than you can use it in all forms
@scrapylegit4690
@scrapylegit4690 3 жыл бұрын
but how do i that? im new to this?. is it easy?
@HassaanRaza
@HassaanRaza 3 жыл бұрын
I'll make a video on it this weekend if you can wait.
@onurtimur524
@onurtimur524 2 жыл бұрын
Great Job Bro Adamsın
@aliardi4859
@aliardi4859 Жыл бұрын
Bonjour merci beaucoup 🌟🌟🌟🌟🌟
@xxjaxxful
@xxjaxxful 3 жыл бұрын
Best solution ! Thanks
@SadamKam
@SadamKam 2 жыл бұрын
bro first of all, thanks for the tutorial .. how about calling the form directly without creating an instance of it . inside form2 .. form1.textbox1.text .. what's wrong with it .. with all do respect .. it doesn't make sense to me to create multiple public variables in order to get data from the parent form .. I've been doing this for entire my life ..
@HassaanRaza
@HassaanRaza 2 жыл бұрын
form1 is not static, so you need the exact instance of form1 to work on thats why its important to create a variable. (the variable store the exact instance of form1) that we want to change.
@andrearruda9005
@andrearruda9005 2 жыл бұрын
Thank you So Much!!!!!
@shiro5410
@shiro5410 Жыл бұрын
amazing
@MarethaNurAzizah
@MarethaNurAzizah Жыл бұрын
omg thank you so much man
@jaimeelipascua8528
@jaimeelipascua8528 2 жыл бұрын
thanks for this..
@rafaelrodriguessilva9994
@rafaelrodriguessilva9994 2 жыл бұрын
Thanks for the vid
@guanyuren3008
@guanyuren3008 Жыл бұрын
Thanks really a lot!
@sonhong6253
@sonhong6253 2 жыл бұрын
great
@mustafakemaltaskn4303
@mustafakemaltaskn4303 Жыл бұрын
Thanks bro.
@irenecarlotto2982
@irenecarlotto2982 2 жыл бұрын
THANKS FOR THIS
@pako_tube6898
@pako_tube6898 2 жыл бұрын
thank you sir
@hamzaaitbrik
@hamzaaitbrik 2 жыл бұрын
Thank you!
@sinarbitonlineservices65
@sinarbitonlineservices65 Жыл бұрын
Thank you
@IvanSchob
@IvanSchob 3 жыл бұрын
thanks it helped
@Maolana_ModiG
@Maolana_ModiG Жыл бұрын
thanks mate
@smoua4588
@smoua4588 3 жыл бұрын
You are God. Thanks!
@HassaanRaza
@HassaanRaza 3 жыл бұрын
just a servant 😉 of God.
@nafisahamid3867
@nafisahamid3867 10 ай бұрын
Hello
@charlyflu9700
@charlyflu9700 2 жыл бұрын
I fucking love you
@HassaanRaza
@HassaanRaza 2 жыл бұрын
haha, nice!
@agressive8050
@agressive8050 3 жыл бұрын
I love u im a man btw lol
@HassaanRaza
@HassaanRaza 3 жыл бұрын
;D its brotherly love then.
@ThaoMeoTV
@ThaoMeoTV 3 жыл бұрын
Singleton.
@a2ei750
@a2ei750 2 жыл бұрын
Hello Thank you for your Help, do you have the solution with VB.NET
@HassaanRaza
@HassaanRaza 2 жыл бұрын
same thing will work for vb, whats the issue?
@a2ei750
@a2ei750 2 жыл бұрын
I'm trying to do data transfer between two forms with VB.NET using a show method, I can't find the solution.
@9962587075
@9962587075 Жыл бұрын
Thank you brother
@MarejKourani
@MarejKourani 7 ай бұрын
Thank you Bro.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
C# - Designing a Flat desktop Application of a Fast Food Restaurant
21:31
Code with HuSyN
Рет қаралды 1,1 МЛН
Intro to Windows Forms (WinForms) in .NET 6
1:35:50
IAmTimCorey
Рет қаралды 240 М.
C#/ Modern Flat UI + Font Awesome Icons, Multicolor, Highlight button, WinForm
24:46
Pass data between two forms in C#
36:08
Programming w/ Professor Sluiter
Рет қаралды 26 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН