473,766 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create LinkLabels At Runtime and Configuring the LabelBox

I have a problem I was hoping someone can help me with. My first problem is
moving a link label that is created at runtime to the of an arraylist on the
next line in the listbox. Currently, the Close link is showing up on the
first line and covering up the file names when the box is populated. Here is
the code:

Dim docArray As New ArrayList() 'create an arraylist to hld the documents.
Dim strDirectory = ConfigurationSe ttings.AppSetti ngs("cad_direct ory")

Dim objLinkClose As New System.Windows. Forms.LinkLabel 'create new linklabel
With objLinkClose
.Name = "lnkClose"
.Text = "Close"
End With

Dim strFile As String

For Each strFile In Directory.GetFi les(strDirector y) 'get the files
in the directory
If Path.GetExtensi on(strFile) = ".doc" Or
Path.GetExtensi on(strFile) = ".pdf" Then
Dim strTemp As String = Path.GetFileNam e(strFile)
docArray.Add(st rTemp)
End If
Next

'If no files are found then inform the user through the listbox.
If docArray.Count( ) = 0 Then
Dim strTmp As String = "No Files to Display.......! "
docArray.Add(st rTmp)
End If
lbdocs.DataSour ce = docArray
Me.lbdocs.Contr ols.Add(objLink Close)

Secondly, I need to make the file names that are returned linklabels also;
so that when a user clicks on one it opens up the file in WORD or PDF(that's
the plan so far). So, any help would greatly be appreciated.
--
TC
Feb 17 '06 #1
1 1299
DWS
Terrance your off to a great start.

search for system.diagnost ics.process.sta rt in msdn library. When checking
the file extention add a .tolower to guarantee a match with odd case.
Path.GetExtensi on(strFile).tol ower = ".pdf"

Good Luck
DWS
"Terrance" wrote:
I have a problem I was hoping someone can help me with. My first problem is
moving a link label that is created at runtime to the of an arraylist on the
next line in the listbox. Currently, the Close link is showing up on the
first line and covering up the file names when the box is populated. Here is
the code:

Dim docArray As New ArrayList() 'create an arraylist to hld the documents.
Dim strDirectory = ConfigurationSe ttings.AppSetti ngs("cad_direct ory")

Dim objLinkClose As New System.Windows. Forms.LinkLabel 'create new linklabel
With objLinkClose
.Name = "lnkClose"
.Text = "Close"
End With

Dim strFile As String

For Each strFile In Directory.GetFi les(strDirector y) 'get the files
in the directory
If Path.GetExtensi on(strFile) = ".doc" Or
Path.GetExtensi on(strFile) = ".pdf" Then
Dim strTemp As String = Path.GetFileNam e(strFile)
docArray.Add(st rTemp)
End If
Next

'If no files are found then inform the user through the listbox.
If docArray.Count( ) = 0 Then
Dim strTmp As String = "No Files to Display.......! "
docArray.Add(st rTmp)
End If
lbdocs.DataSour ce = docArray
Me.lbdocs.Contr ols.Add(objLink Close)

Secondly, I need to make the file names that are returned linklabels also;
so that when a user clicks on one it opens up the file in WORD or PDF(that's
the plan so far). So, any help would greatly be appreciated.
--
TC

Feb 17 '06 #2

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

Similar topics

5
1495
by: Patrick Marti | last post by:
I wish to create some LinkButtons in DotNet. Because I will do it in dependence of the entries in a database, I can not add them with the mouse to the form as usually. I can create them in the Page_Load event but then I can not see them. I do not know the reason or how to do it correctly. Do anywhere know something about? For any help, I thanks a lot Greetings Patrick Marti
8
3193
by: Steve Neill | last post by:
Can anyone suggest how to create an arbitrary object at runtime WITHOUT using the deprecated eval() function. The eval() method works ok (see below), but is not ideal. function Client() { } Client.prototype.fullname = "John Smith"; var s = "Client"; eval("var o = new " + s + "();"); alert(o.fullname);
0
994
by: HamuNaptra | last post by:
Hi, I have a form which contains more than 15 linklabels, all of them have a transparant backcolor. The form itself has a backgroundimage. Now when I show the form, it takes a moment to refresh all the controls and a black rectangle comes into place of each of the linklabels before they refresh. Since this is very ugly, I'm looking for way to get rid of this.
0
1086
by: Wajih | last post by:
I have a list view. I want to insert LinkLabels dynamically in it as ListViewSubItems. Is it possible to do this? If yes, how should i do it. If no, are there any workarounds. Thanx and regards
6
13728
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the error (seems to be happening when I try creating a directory) If dirmgr.Exists("s:\blah\" & txt_name.Text) Then lblerror.Text = lblerror.Text & "Unable to build physical path. " &
1
1316
by: | last post by:
This is a crosspost from a less-frequented (but more focused) asp.net group; I didn't receive an answer that worked. I'd like to get this form functional. Could someone help on what's probably a simple syntax issue? I've attempted my due diligence with the usual books and references...but I'm new to ASP.NET. Question follows: The Code Project has a nice article on making a "self configuring form mailer web control." Basically, you apply...
0
1117
by: Terrance | last post by:
Hello, I was wondering if anyone can help me. I have some code where I'm creating linklabels during runtime using filenames that in a directory. I created a LinkClicked event but it only launches the last file that is called in the ClickEvent. I tried placing the Event in the FOR EACH statement but that's not helping. If interested I'm using VB2005. How can I apply a Click Event to each LinkLabel or each linklabel to the same ClickedEvent?...
1
2618
by: rada.lambretha | last post by:
Configuring Linux as a Firewall * Making installation choices * Introducing iptables * Using iptables commands * Simplifying things with firewall GUIs * Adding proxy functionality As Linux gains increasing acceptance in corporate datacenters and
4
4165
by: Axel Dahmen | last post by:
Hi, I've created a few simple console tools. No .NET used at all, just STL. Now I want to just XCOPY them to another machine. But running them there yields a couple of errors in the application log telling me that some ..NET DLL could not be found: "The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more details."
0
9404
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
10168
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
9838
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
8835
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
7381
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
6651
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
5279
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...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.