473,811 Members | 3,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems Dynamically creating a LinkLabel

Hi There,

I'm trying to create a link label dynmically. The problems I'm having is
the following:
1. The LinkLabel is created without the underline
2. The click event is not being raised...

Here's my code:

Dim newLink As New LinkLabel()
With newLink
pnlTitle.Contro ls.AddRange(New System.Windows. Forms.Control() {newLink})
..Left = 100
..Top = 100
..AutoSize = True
..LinkBehavior = LinkBehavior.Al waysUnderline
..ActiveLinkCol or = System.Drawing. Color.Red
..Font = FontConv.Conver tFromString("Ve rdana, 14.25pt")
..Text = Desc
AddHandler .Click, AddressOf Me.Links_LinkCl icked
AddHandler .MouseMove, AddressOf Me.Links_MM
End With

and the subs:
Private Sub Links_LinkClick ed(ByVal sender As Object, ByVal e As
System.EventArg s)
MessageBox.Show ("Link Clicked")
End Sub

Any Ideas?

Josh
Nov 20 '05 #1
1 3749
* "Joshua Ellul" <je****@onvol.n et> scripsit:
I'm trying to create a link label dynmically. The problems I'm having is
the following:
1. The LinkLabel is created without the underline
2. The click event is not being raised...

Here's my code:

Dim newLink As New LinkLabel()
With newLink
pnlTitle.Contro ls.AddRange(New System.Windows. Forms.Control() {newLink})
.Left = 100
.Top = 100
.AutoSize = True
.LinkBehavior = LinkBehavior.Al waysUnderline
.ActiveLinkColo r = System.Drawing. Color.Red
.Font = FontConv.Conver tFromString("Ve rdana, 14.25pt")
.Text = Desc
AddHandler .Click, AddressOf Me.Links_LinkCl icked
AddHandler .MouseMove, AddressOf Me.Links_MM
End With

and the subs:
Private Sub Links_LinkClick ed(ByVal sender As Object, ByVal e As
System.EventArg s)
MessageBox.Show ("Link Clicked")
End Sub

Any Ideas?


I am not able to repro problem 2 with the code listed above. I use .NET 1.0,
Windows XP Professional.

For your 1st gestion:

\\\
..Font = New Font(Me.Font, FontStyle.Under line)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5086
by: Max | last post by:
Suppose we have an object hierarchy in XSD. For example, let us take Control, Label, TextBox and LinkLabel windows controls. Each control has some properties which are represented as elements. Some of the elements are of complex types as well, like bounds - of type rectangle. (See full example in the bottom of the letter.) DataSet.ReadXMLSchema fails to parse such XSD file. The problem is caused by complex type as an element of the...
0
1901
by: tota | last post by:
i'm using windowsApplication to connect to DB made by SQL i need to Display the Data of the first table in the DB as links when click it it openes a table and i navigte between them using buttons my problem is that i need to make the retrieved data as links (similar to objectList in Mobile application) i used LinkLabel to make an array of LinkLabels for (int n=0 ; i<j ; i++) {
0
1824
by: Frnak McKenney | last post by:
One of the reasons given for the Allied victory in WWI is that the Nazi armament industry invested so much effort in creating new weapons (e.g. the jet plane) it wasn't able to develop any of them to the point of mass-production. There are days when I experience the same difficulties with C# and dotNET: there are twelve ways to do 'most _any_thing, and I wind up exploring six before I find an acceptable solution. <grin> Case in...
1
5329
by: gabe | last post by:
I am looking for a way to mimic some of the functionality of a web page without writing html (or I am looking to someone to point out something really obvious that I am over looking) Currently I read out some data into a dataset then appending it to a richtextbox. So far so good. Some of the fields that I append are paths to documents. I would like to be able to click on the paths (like a hyperlink) I am able to create a linklabel at...
3
12033
by: vince | last post by:
Hello, I have a ListBox filled with many lines of simply text I want to make few lines be a LinkLabel How can I do this Thanks
2
3061
by: Terrance | last post by:
Can someone please help with a problem that I'm having? I'm trying to create a linklabel in VB.NET 2003 at runtime when a user clicks a button. The app looks in a path for .doc and .pdf files and creates a linklabel for each file name. When running the app the first name is being created but only portions of the string is showing; and also it looks like the remaining is being created but I can't see them it's like their cut off. Here is the...
3
4699
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The form that has the System.Windows.Forms.LinkLabel controls on it is in a different project and under a different namespace from the file where the LinkLabel_LinkClicked events are, so I can't just do frm.ShowDialog under the LinkClicked method. ...
2
2141
by: prokopis | last post by:
am using c# for windows applications. am using dynamic linklayer array to print some labels in the form.i get some data from the database i add them in the linklabel array and i print it on the screen. my problem is how to make that linklabel to work when i select the label.am using the code below but is not working:) public class Form1 : Form { System.Windows.Forms.LinkLabel linklabel;
0
944
by: georgevarghese3 | last post by:
i was able to add linklabel dynamically to split continer and if the text of the link label is bigger than the pannel in the contianer then i use scroll but after that when again adding the control position of the link label starts from where the scroll bar beging how can i change that .Iam working on c#.net windows application 2008,operating system xp
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10130
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6887
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.