C# -- LinkLabel Parameter Passing ?

finance_teacher
finance_teacher used Ask the Experts™
on
How can I change the below
to pass "iDTextBox.Text" ?

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("IExplore", "http://www.google.com?id=iDTextBox.Text");
            linkLabel1.LinkColor = Color.Black;
            linkLabel1.LinkVisited = true;
        }
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Hi,

Like this

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("IExplore", string.Format("http://www.google.com?id={0}", iDTextBox.Text));
            linkLabel1.LinkColor = Color.Black;
            linkLabel1.LinkVisited = true;
        }

/peter
or you can do this:

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("IExplore", "http://www.google.com?id=" + iDTextBox.Text);
            linkLabel1.LinkColor = Color.Black;
            linkLabel1.LinkVisited = true;
        }
Incidentally, I use pivar's technique whenever I can. I find it's easier for me to follow, especially when there's LOTS of variables being included in a single-line string.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial