Hi everyone, I got some problem this week. I don't know the
coding for "Linklabel" in C#.net. In ASP.net, I use it
"Response.Redirect" and "Server.Transfer" and I also can use
hyperlink. When offline I use "linklabel", Now I still write
by "System.Dianogstic", It still showing error and can't
reach my dedicated page(Means design page). So if anyone
know it, please share your technical help. Thanks (Horace
Trever)



Hi everyone, I got some problem this week. I don't know the coding for "Linklabel" i..

Answer / kishore ganti

Add a LinkLabel to a Form manually
The MSDN page for the LinkLabel control has the following
example showing how to add a LinkLabel to a Form.
private LinkLabel linkLabel1;

public Form1()
{
CreateMyLinkLabel();
}

public void CreateMyLinkLabel()
{
// Create the LinkLabel.
linkLabel1 = new LinkLabel();

// Configure the LinkLabel's size and location. Specify
that the
// size should be automatically determined by the content.
this.linkLabel1.Location = new System.Drawing.Point(34,
56);
this.linkLabel1.Size = new System.Drawing.Size(224, 16);
this.linkLabel1.AutoSize = true;

// Configure the appearance.
// Set the DisabledLinkColor so that a disabled link will
show up against
// the form's background.
this.linkLabel1.DisabledLinkColor =
System.Drawing.Color.Red;
this.linkLabel1.VisitedLinkColor =
System.Drawing.Color.Blue;
this.linkLabel1.LinkBehavior =
System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel1.LinkColor = System.Drawing.Color.Navy;

this.linkLabel1.TabIndex = 0;
this.linkLabel1.TabStop = true;

// Add an event handler to do something when the links
are clicked.
this.linkLabel1.LinkClicked +=
new LinkLabelLinkClickedEventHandler
(this.linkLabel1_LinkClicked);

// Identify what the first Link is.
this.linkLabel1.LinkArea = new
System.Windows.Forms.LinkArea(0, 8);

// Identify that the first link is visited already.
this.linkLabel1.Links[0].Visited = true;

// Set the Text property to a string.
this.linkLabel1.Text = "Register Online. Visit
Microsoft. Visit MSN.";

// Create new links using the Add method of the
LinkCollection class.
// Underline the appropriate words in the LinkLabel's
Text property.
// The words 'Register', 'Microsoft', and 'MSN' will
// all be underlined and behave as hyperlinks.

// First check that the Text property is long enough to
accommodate
// the desired hyperlinked areas. If it's not, don't add
hyperlinks.
if (this.linkLabel1.Text.Length >= 45)
{
this.linkLabel1.Links[0].LinkData =
this.linkLabel1.Text.Substring(0, 8);
this.linkLabel1.Links.Add(24, 9, "www.microsoft.com");
this.linkLabel1.Links.Add(42, 3, "www.msn.com");
// The second link is disabled and will appear as red.
this.linkLabel1.Links[1].Enabled = false;
}

this.Controls.Add(linkLabel1);
}

private void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
// Determine which link was clicked within the LinkLabel.
this.linkLabel1.Links[linkLabel1.Links.IndexOf
(e.Link)].Visited = true;

// Display the appropriate link based on the value of the
// LinkData property of the Link object.
string target = e.Link.LinkData as string;

// If the value looks like a URL, navigate to it.
// Otherwise, display it in a message box.
if (null != target && target.StartsWith("www"))
{
System.Diagnostics.Process.Start(target);
}
else
{
MessageBox.Show("Item clicked: " + target);
}
}




try this one if it relates

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DotNet Errors Interview Questions

what is wrong with this insert into code? vb 2008 say that there is a syntax error but i believe there is nothing.. cmd.CommandText = " INSERT INTO account1(username, password, lname, fname, mi) VALUES('" & Me.TextBox4.Text & "','" & Me.TextBox5.Text & "','" & Me.TextBox1.Text & "','" & Me.TextBox2.Text & "','" & Me.TextBox3.Text & "')" cmd.ExecuteNonQuery()

2 Answers  


How to use singal crystal report viewer to multiple reports?

1 Answers   Sparsh,


how we change the .net 1.0 to .net 2.0?is that can we only paste the dll file?

1 Answers  


In .net how many error will occur?

0 Answers   Chevrolet, TCS,


not being able to create delivery from vl01n inspite of assigning sales order and delivery plz answer it immediately if any one knows

1 Answers  


while am using file upload control in the content type=="pjpeg" then it will execute,but if the content type=="jpeg" it is not execute.What it is the meaning of i.e:"pjpeg" i want to upload all type of images like jpeg,bmp,gif etc..,and that image is display in the "image control" when am click the Button click event...HOW.. Plz replay ...

2 Answers  


Actually,I created a web application in ASP.NET (Visual Studio 2008) in C#.If i want to run my web application in my local machine through IIS Server (Internet Information Server), what are all the steps i need to follow??? Please help me to run my web application in IIS Server

1 Answers  


How to find out syntax error by manual testing

3 Answers  


Weather I can use Dotnet framework 1.0 and 2.0 in same machine for Two application or not if "Yes" then how will configure in IIS for Framework 1.0 and 2.0 First Application will be working in .net Frame work 1.0 Send will be .net Frame work 2.0 How to Configure IIS for both Application using Virtual Directory I tried but when Confirte 1.0 then Second Application not working which is having 2.0 Framework but when Conf. 2.0 then Send Application works but First app. Not Work ...... How I Configure IIS for both Application Throwing ERR "The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. " After Hitting Refresh Button also not works...... ?

2 Answers   ISST,


how to track links visited in google using iframes in dotnet

1 Answers  


a cowboy rides to town on friday he stays there for three days and lives on friday.how was that possible

2 Answers   Synechron,


What is Managerial Grid? Contract its approach to leadership with the approaches of the Ohio state and Michigan groups.

1 Answers  


Categories