6 Replies - 181 Views - Last Post: 08 October 2018 - 02:18 PM Rate Topic: -----

#1 skip2111   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-October 18

Pass data from one form another already open form

Posted 08 October 2018 - 12:44 PM

Hi, apologies for the lack of coding skills here, but i'm sure this is a very simple problem. I am writing a system where essentially I click on one of a series of buttons and this generates a value in a data grid on a separate form. I have no idea how to do this, as all of the things I have done in the past and all of the research i have done involves passing values to a new form when it is created.

As some background, what i am trying to do is have a layout of a classroom with a button representing each students computer in a room. The school has a system where misbehaving students names are added to a board. I would like to computerise this for myself. So i want to click on a button, and have the students name appear in the DGV on the second form which will be always on the screen.


Can anyone point me in the direction of how i might be able to pass a value to an already open form?

I hope I haven't annoyed anyone here as I am new!

Thanks :)

Is This A Good Question/Topic? 0
  • +

Replies To: Pass data from one form another already open form

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14487
  • View blog
  • Posts: 58,070
  • Joined: 12-June 08

Re: Pass data from one form another already open form

Posted 08 October 2018 - 12:49 PM

Is this 'already open form' a completely different program, or in your VB.NET solution?
Was This Post Helpful? 0
  • +
  • -

#3 skip2111   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-October 18

Re: Pass data from one form another already open form

Posted 08 October 2018 - 01:08 PM

View Postmodi123_1, on 08 October 2018 - 12:49 PM, said:

Is this 'already open form' a completely different program, or in your VB.NET solution?



They will both be part of the same solution.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14487
  • View blog
  • Posts: 58,070
  • Joined: 12-June 08

Re: Pass data from one form another already open form

Posted 08 October 2018 - 01:21 PM

Are you locked into using winforms, or is WPF an option?

Forms are just objects. You would declare a form, instantiate it with 'new', and if you have it in global scope it would exist for the duration of the app. You can interact with the second form using properties, functions, etc that have a 'public' scope.
Was This Post Helpful? 0
  • +
  • -

#5 skip2111   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-October 18

Re: Pass data from one form another already open form

Posted 08 October 2018 - 01:30 PM

View Postmodi123_1, on 08 October 2018 - 01:21 PM, said:

Are you locked into using winforms, or is WPF an option?

Forms are just objects. You would declare a form, instantiate it with 'new', and if you have it in global scope it would exist for the duration of the app. You can interact with the second form using properties, functions, etc that have a 'public' scope.


I can do whatever I like, Im just pretty inexperienced. Ive never used WPF. So, lets say I have my main form - which would be my classroom with the computers in it represented by buttons. This form will minimised a lot of the time. When someone does something wrong, i will use this form and clock on the naughty kids computer (button) and it will add their name to a datagrid view on a separate form which will be on the screen at all times so its visible to the kids.

Can this be done with the method u describe? Can you point me in the way of an example or tutorial?
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14487
  • View blog
  • Posts: 58,070
  • Joined: 12-June 08

Re: Pass data from one form another already open form

Posted 08 October 2018 - 01:41 PM

Quote

which will be on the screen at all times so its visible to the kids.

On a screen like the individual PCs or on some projector?



WPF is the more modern way of doing a desktop app. It's C# centric - VB.NET's cousin.

https://docs.microso...etting-started/
https://docs.microso...top-application
https://docs.microso...idview-overview

Yes - it has forms, grids, buttons, and the usual class ways - I mentioned above - to do your project. Is there a tutorial on your very niche project? No, but certainly you can look at things that are WPF related..

wpf new second form
wpf button events
wpf drop down list
wpf saving data
wpf gridview

Was This Post Helpful? 1
  • +
  • -

#7 skip2111   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-October 18

Re: Pass data from one form another already open form

Posted 08 October 2018 - 02:18 PM

View Postmodi123_1, on 08 October 2018 - 01:41 PM, said:

Quote

which will be on the screen at all times so its visible to the kids.

On a screen like the individual PCs or on some projector?



WPF is the more modern way of doing a desktop app. It's C# centric - VB.NET's cousin.

https://docs.microso...etting-started/
https://docs.microso...top-application
https://docs.microso...idview-overview

Yes - it has forms, grids, buttons, and the usual class ways - I mentioned above - to do your project. Is there a tutorial on your very niche project? No, but certainly you can look at things that are WPF related..

wpf new second form
wpf button events
wpf drop down list
wpf saving data
wpf gridview




Thanks ive solved that part of it with a regular windows form atm, but I will look into WPF as
I literally have never used one! Thanks :) All new challenges are occurring now lol
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1