G
Guest
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.Text.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.GetFiles(strPath)
If Path.GetExtension(strFile).ToLower = ".doc" Or
Path.GetExtension(strFile).ToLower = ".pdf" Then
strTemp = Path.GetFileName(strFile)
Dim myLinkLabel As New LinkLabel
With myLinkLabel
.Name = "lnkLabel_" & i.ToString()
.Visible = True
.ActiveLinkColor = Color.Red
.DisabledLinkColor = Color.Blue
.LinkColor = Color.Blue
.VisitedLinkColor = Color.Purple
.Text = strTemp
End With
plMain.Controls.Add(myLinkLabel)
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?
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.Text.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.GetFiles(strPath)
If Path.GetExtension(strFile).ToLower = ".doc" Or
Path.GetExtension(strFile).ToLower = ".pdf" Then
strTemp = Path.GetFileName(strFile)
Dim myLinkLabel As New LinkLabel
With myLinkLabel
.Name = "lnkLabel_" & i.ToString()
.Visible = True
.ActiveLinkColor = Color.Red
.DisabledLinkColor = Color.Blue
.LinkColor = Color.Blue
.VisitedLinkColor = Color.Purple
.Text = strTemp
End With
plMain.Controls.Add(myLinkLabel)
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?