can anyone tell me if one can create a form level variable in c# and how one does that. with form level variable i maen a variable which can be accessed by all the command buttons on the form. the buttons are on different panels. i dont know if that would make a difference. i doubt it. but just how do i create a variable which can be accesses by all the buttons on the form.
Ravenous Wolf
23
Junior Poster
Recommended Answers
Jump to Postby buttons I assume you mean event handlers? (ignore that--I don't know why I'm so mean)
Anyway, try declaring the variables outside of any methods, but instead, declare them right after the class declaration (before the constructor), Like so:
public partial class FooForm : Form { …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.