Click here to Skip to main content
15,886,777 members
Home / Discussions / C#
   

C#

 
AnswerRe: multiple loading of assemblies - does it have any associated problems? Pin
Eddy Vluggen2-Oct-12 4:29
professionalEddy Vluggen2-Oct-12 4:29 
AnswerRe: multiple loading of assemblies - does it have any associated problems? Pin
jschell2-Oct-12 8:42
jschell2-Oct-12 8:42 
AnswerRe: multiple loading of assemblies - does it have any associated problems? Pin
Dave Kreskowiak2-Oct-12 12:29
mveDave Kreskowiak2-Oct-12 12:29 
SuggestionRe: multiple loading of assemblies - does it have any associated problems? Pin
Guirec2-Oct-12 18:11
professionalGuirec2-Oct-12 18:11 
GeneralRe: multiple loading of assemblies - does it have any associated problems? Pin
jschell3-Oct-12 10:16
jschell3-Oct-12 10:16 
AnswerRe: multiple loading of assemblies - does it have any associated problems? Pin
BobJanova3-Oct-12 5:05
BobJanova3-Oct-12 5:05 
QuestionWhen to use .PerformClick() Pin
MAW301-Oct-12 15:07
MAW301-Oct-12 15:07 
AnswerRe: When to use .PerformClick() Pin
DaveyM691-Oct-12 16:05
professionalDaveyM691-Oct-12 16:05 
It seems like you have made buttonStart_Click public static in your FormCalendarCS class which is why you can access it (probably not a good idea!), whereas buttonStart is an instance created in the designer of your FormCalendarCS (exactly as it should be, check the contents of the designer.cs file).

Creating a new instance of the form will not get you the original button, just a new one on a new form that you haven't made visible so you will never see it.

First of all, change buttonStart_Click to private void buttonStart_Click(object sender, EventArgs e), there is no valid reason to have it any other way IMO, and if you have changed it, set the access modifier on buttonStart back to private.

Inside FormCalendarCS create this method:
C#
public void ButtonStartPerformClick()
{
    buttonStart.PerformClick();
}

Inside your form where you first show your FormCalendarCS instance, add a field:
C#
private FormCalendarCS formCalendarCS;

Before you show it, save the instance to the field.
C#
formCalendarCS = new FormCalendarCS();
formCalendarCS.Show();

Now whenever you want to perform the click, just call:
C#
formCalendarCS.ButtonStartPerformClick();

If the relationships between your classes/forms are more complex, you will need to route the method call(s) appropriately and you may need to use events too if you need to call back up the chain.

Your problem boils down to not understanding instance vs static objects and methods. These are a fundemental part of any OOP language including C# so I suggest some study on this area.
Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: When to use .PerformClick() Pin
MAW301-Oct-12 16:55
MAW301-Oct-12 16:55 
AnswerRe: When to use .PerformClick() Pin
Dave Kreskowiak2-Oct-12 1:32
mveDave Kreskowiak2-Oct-12 1:32 
GeneralRe: When to use .PerformClick() Pin
DaveyM692-Oct-12 3:02
professionalDaveyM692-Oct-12 3:02 
AnswerRe: When to use .PerformClick() Pin
Ravi Bhavnani2-Oct-12 6:22
professionalRavi Bhavnani2-Oct-12 6:22 
Questionwhy i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Kay Pee Singh1-Oct-12 12:46
Kay Pee Singh1-Oct-12 12:46 
AnswerRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Smart Arab2-Oct-12 2:45
Smart Arab2-Oct-12 2:45 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Eddy Vluggen2-Oct-12 3:24
professionalEddy Vluggen2-Oct-12 3:24 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Kay Pee Singh2-Oct-12 6:52
Kay Pee Singh2-Oct-12 6:52 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Eddy Vluggen2-Oct-12 8:06
professionalEddy Vluggen2-Oct-12 8:06 
Generalcan u tell me where is the error in this code so i can change .....?? Pin
Kay Pee Singh2-Oct-12 10:08
Kay Pee Singh2-Oct-12 10:08 
AnswerRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Eddy Vluggen2-Oct-12 3:25
professionalEddy Vluggen2-Oct-12 3:25 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Kay Pee Singh2-Oct-12 6:51
Kay Pee Singh2-Oct-12 6:51 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Pete O'Hanlon2-Oct-12 7:34
mvePete O'Hanlon2-Oct-12 7:34 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Kay Pee Singh2-Oct-12 9:52
Kay Pee Singh2-Oct-12 9:52 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Kay Pee Singh2-Oct-12 10:02
Kay Pee Singh2-Oct-12 10:02 
GeneralRe: why i cant store values in database but my data is correct its not showing any error help me .....?? Pin
Pete O'Hanlon2-Oct-12 10:24
mvePete O'Hanlon2-Oct-12 10:24 
Generalhow can i check my entered value is going to SQL server or not ???? Pin
Kay Pee Singh2-Oct-12 10:56
Kay Pee Singh2-Oct-12 10:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.