6 Replies - 1485 Views - Last Post: 10 October 2011 - 11:39 AM Rate Topic: -----

#1 Mennovf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-October 11

Passing variable(addresses) to a Windows Form

Posted 09 October 2011 - 12:24 PM

How would I go about passing variables or their adresses to a Windows Form.
I need the Windows Form to change some variables by using an accesor function of a class outside off the Windows Form.
Creating the class as an element of the Windows Form should also be Ok but I've tried creating it in the protected section of the form and have it being initialised using the initComponents() function of the Form and this seems to have messed up my Form. In the design view it now shows a default Form instead of the one I created earlier altough the compiler doesn't complain.

Is This A Good Question/Topic? 0
  • +

Replies To: Passing variable(addresses) to a Windows Form

#2 tlhIn`toq  Icon User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6508
  • View blog
  • Posts: 14,381
  • Joined: 02-June 10

Re: Passing variable(addresses) to a Windows Form

Posted 09 October 2011 - 03:45 PM

Until someone has a more specific example for you:

See FAQ #2

The examples are C#, but you shouldn't have too much trouble reading C# and translating to your native C flavor


FAQ (Frequently Asked Questions - Updated Sep 2011

Spoiler

This post has been edited by tlhIn`toq: 09 October 2011 - 03:45 PM

Was This Post Helpful? 1
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Passing variable(addresses) to a Windows Form

Posted 09 October 2011 - 03:47 PM

Windows Form...are you using Managed C++ or C#?
Was This Post Helpful? 1
  • +
  • -

#4 Mennovf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-October 11

Re: Passing variable(addresses) to a Windows Form

Posted 09 October 2011 - 10:34 PM

I'm sorry for not reading the FAQ before asking this question tlhIn`toq, I guess that's the first thing I'll do now.
It seems that my problem was that I initialised the variable inside of the InitializeComponents() function of the form, I changed it so that it initialised in de constructor itself and this seems to have fixed the problem. But why would the Form be messed up after changing the initialiseComponents() function?
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6508
  • View blog
  • Posts: 14,381
  • Joined: 02-June 10

Re: Passing variable(addresses) to a Windows Form

Posted 10 October 2011 - 06:43 AM

As a rule, we stay out of the designer files. Visual Studio does a lot in there and keeps re-writing those files. If those re-writes conflict with things you've done you get weird behavior.

It clearly says "Do not modify the contents of this method with the code editor."

Attached Image
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6508
  • View blog
  • Posts: 14,381
  • Joined: 02-June 10

Re: Passing variable(addresses) to a Windows Form

Posted 10 October 2011 - 06:51 AM

View PostMennovf, on 09 October 2011 - 11:34 PM, said:

I changed it so that it initialised in de constructor itself and this seems to have fixed the problem.


I was about to type a big explanation of why initializing in the deconstructor was a waste of type and what the deconstructor is/does. When I realized you probably didn't mean 'de constructor'.

Do you mean you initialized it in the constructor? Because if you initialize a variable in the deconstructor as you typed that would be pointless.

This is a great example of why we tell people to not try to be 'cool' in their typing by using 'de' for 'the', 'dat' for 'that', UR, and so on. It becomes very confusing when people try to type all rasta and ghetto.
Was This Post Helpful? 0
  • +
  • -

#7 Mennovf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-October 11

Re: Passing variable(addresses) to a Windows Form

Posted 10 October 2011 - 11:39 AM

View PosttlhIn`toq, on 10 October 2011 - 06:51 AM, said:

This is a great example of why we tell people to not try to be 'cool' in their typing by using 'de' for 'the', 'dat' for 'that', UR, and so on. It becomes very confusing when people try to type all rasta and ghetto.


Yes I actually meant THE constructor, was a real typo on my part, "de" means "the" in my mother tongue, I make this mistake sometimes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1