Click here to Skip to main content
15,894,180 members
Home / Discussions / C#
   

C#

 
Questionmovable combobox in datagridview in C# windows application Pin
ranjeet1112-Oct-14 21:51
ranjeet1112-Oct-14 21:51 
QuestionAccessing WCF from Excel/VBA Pin
devvvy12-Oct-14 5:19
devvvy12-Oct-14 5:19 
QuestionRe: Accessing WCF from Excel/VBA Pin
Richard MacCutchan12-Oct-14 8:57
mveRichard MacCutchan12-Oct-14 8:57 
AnswerRe: Accessing WCF from Excel/VBA Pin
CHill6012-Oct-14 9:11
mveCHill6012-Oct-14 9:11 
AnswerRe: Accessing WCF from Excel/VBA Pin
devvvy14-Oct-14 8:04
devvvy14-Oct-14 8:04 
AnswerRe: Accessing WCF from Excel/VBA Pin
Mycroft Holmes12-Oct-14 12:46
professionalMycroft Holmes12-Oct-14 12:46 
GeneralRe: Accessing WCF from Excel/VBA Pin
devvvy13-Oct-14 9:29
devvvy13-Oct-14 9:29 
GeneralRe: Accessing WCF from Excel/VBA Pin
Mycroft Holmes13-Oct-14 12:28
professionalMycroft Holmes13-Oct-14 12:28 
GeneralRe: Accessing WCF from Excel/VBA Pin
devvvy14-Oct-14 8:05
devvvy14-Oct-14 8:05 
Questionhow to delete a member of list<class> (list is Generic), by clicking button in form. Pin
cicill12-Oct-14 4:42
cicill12-Oct-14 4:42 
AnswerRe: how to delete a member of list<class> (list is Generic), by clicking button in form. Pin
BillWoodruff12-Oct-14 5:21
professionalBillWoodruff12-Oct-14 5:21 
QuestionHow to get the license key from here? Pin
Jassim Rahma11-Oct-14 10:11
Jassim Rahma11-Oct-14 10:11 
AnswerRe: How to get the license key from here? Pin
Garth J Lancaster11-Oct-14 13:11
professionalGarth J Lancaster11-Oct-14 13:11 
Questionmultiple Update query after Filter in datagridview Pin
AsthreA11-Oct-14 4:42
AsthreA11-Oct-14 4:42 
AnswerRe: multiple Update query after Filter in datagridview Pin
Richard Deeming13-Oct-14 2:21
mveRichard Deeming13-Oct-14 2:21 
Questioncreate Web browser in C# without using web browser control Pin
Member 1114079710-Oct-14 9:44
Member 1114079710-Oct-14 9:44 
AnswerRe: create Web browser in C# without using web browser control Pin
Eddy Vluggen10-Oct-14 9:46
professionalEddy Vluggen10-Oct-14 9:46 
AnswerRe: create Web browser in C# without using web browser control Pin
Pete O'Hanlon10-Oct-14 9:56
mvePete O'Hanlon10-Oct-14 9:56 
Questionhi friends Pin
Member 111430869-Oct-14 22:52
Member 111430869-Oct-14 22:52 
AnswerRe: hi friends Pin
Eddy Vluggen10-Oct-14 7:51
professionalEddy Vluggen10-Oct-14 7:51 
QuestionPlaying media with 2 different channels in stereo file using NAudio library Pin
Praveen Raghuvanshi9-Oct-14 17:55
professionalPraveen Raghuvanshi9-Oct-14 17:55 
AnswerRe: Playing media with 2 different channels in stereo file using NAudio library Pin
Eddy Vluggen10-Oct-14 7:53
professionalEddy Vluggen10-Oct-14 7:53 
QuestionWinform Change Label Text from secondary form action Pin
Derek Kennard9-Oct-14 1:56
professionalDerek Kennard9-Oct-14 1:56 
AnswerRe: Winform Change Label Text from secondary form action Pin
BillWoodruff9-Oct-14 3:00
professionalBillWoodruff9-Oct-14 3:00 
GeneralRe: Winform Change Label Text from secondary form action Pin
Derek Kennard9-Oct-14 15:28
professionalDerek Kennard9-Oct-14 15:28 
Perfect, absolutely perfect. This is exactly what I needed. Big Grin | :-D

Here is what I did...

C#
// in LocationChange (aka Form2)
        private string _holdSecLoc;
        private string _holdTeam;
        private string _holdUname;

// a bunch of other form code here...

        // a template for a method that takes three string parameters and returns void
        public Action<string, string, string> ChangeLabels;

        private void ChgLoc()
            {
            GetPrimeLocBal.UidDal = Login.PassUserIdText;
            GetPrimeLocBal.NewLoc = tbLocId.Text;
            }

        private void btnChange_Click( object sender, EventArgs e )
            {
            // a button in the secondary form that will call the method
            // injected into the secondary form by its creator, the main form
            ChgLoc();
            GetPrimeLocBal.GetPrime();
            _holdUname = GetPrimeLocBal.UidDal;
            _holdTeam = GetPrimeLocBal.TeamName;
            _holdSecLoc = GetPrimeLocBal.SecondaryLoc;
            ChangeLabels( _holdUname, _holdTeam, _holdSecLoc );
            Close();
            }


Now in MainDesktop (aka Form1)

C#
// added this to private void MainDesktop_Load( object sender, EventArgs e )

            _locChgChange.ChangeLabels = delegate( string s1, string s2, string s3 )
            {
                // update the labels
                tssUserId.Text = s1;
                tssTeam.Text = s2;
                tssPrimeLoc.Text = s3;
            };

// instead of showing the form2 in the load...

        private void changeSitesToolStripMenuItem_Click( object sender, EventArgs e )
            {
            // expose the secondary form
            _locChgChange.Show();
            }

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.