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

Home Posts Topics Members FAQ

Creating a LinkLabel Programmaticall y

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 code from
the button's click event:

Dim strPath As String = txtDirectory.Te xt.ToString()
Dim strTemp, strFile As String
Const intX As Integer = 16
Dim intY As Integer = 8
Const intHeight As Integer = 16
Const intWidth As Integer = 100
Dim intX2 As Integer = 0
Dim i As Integer

For Each strFile In Directory.GetFi les(strPath)
If Path.GetExtensi on(strFile).ToL ower = ".doc" Or
Path.GetExtensi on(strFile).ToL ower = ".pdf" Then
strTemp = Path.GetFileNam e(strFile)

Dim myLinkLabel As New LinkLabel
With myLinkLabel
.Name = "lnkLabel_" & i.ToString()
.Visible = True
.ActiveLinkColo r = Color.Red
.DisabledLinkCo lor = Color.Blue
.LinkColor = Color.Blue
.VisitedLinkCol or = Color.Purple
.Text = strTemp
End With
plMain.Controls .Add(myLinkLabe l)

End If
i += 1
Next

I'm trying to set the Location.X for each created LinkLabels but VB is not
liking it. It's telling me that an integer can not be a system.drawing. point
type. What am I doing wrong?

--
TC
Apr 11 '06 #1
2 3060
Hi,
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.
I was working on a similar app sometime back and was facing similar
problems. Seemed to work fine, when I set the AutoSize and LinkArea
properties correctly. (Set AutoSize to True.)
I'm trying to set the Location.X for each created LinkLabels but VB is not
liking it. It's telling me that an integer can not be a system.drawing. point
type.


You mustn't try to set the X or Y properties of the Location Property
(See "Control.Locati on" in MSDN help for the explanation). Instead set
it's Location to a new Point() as :

myLinkLabel.Loc ation = New Point(intX * i, intY * i)

where i can be incremented with each label.

Hope this helps,

Regards,

Cerebrus.

Apr 11 '06 #2
Thanks Cerebrus for the help.
--
TC
"Cerebrus" wrote:
Hi,
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.
I was working on a similar app sometime back and was facing similar
problems. Seemed to work fine, when I set the AutoSize and LinkArea
properties correctly. (Set AutoSize to True.)
I'm trying to set the Location.X for each created LinkLabels but VB is not
liking it. It's telling me that an integer can not be a system.drawing. point
type.


You mustn't try to set the X or Y properties of the Location Property
(See "Control.Locati on" in MSDN help for the explanation). Instead set
it's Location to a new Point() as :

myLinkLabel.Loc ation = New Point(intX * i, intY * i)

where i can be incremented with each label.

Hope this helps,

Regards,

Cerebrus.

Apr 11 '06 #3

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++) {
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...
1
3749
by: Joshua Ellul | last post by:
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()
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
0
1269
by: Suz | last post by:
I am stumped! I can't seem to figure out how to put a linklabel in a datagrid on a windows form. I have working code that displays a linklabel in edit mode but need the linklabel to display during the initial datagrid load. I am working with datagridcolumnstyles. I have looked at combobox examples, etc but can't seem to extrapolate. Any help appreciated! Thanks!
1
1747
by: Marcus Kwok | last post by:
I am having problems getting my LinkLabel hyperlink to work properly. Every time I click on it, I get the following exception: System.ComponentModel.Win32Exception: The requested lookup key was not found in any active activation context at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at...
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
9603
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
10379
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...
1
10393
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10124
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
9200
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
7664
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
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
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.