473,545 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need a good idea :)

Hi all,

i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.

the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.

so any ideas??

i'm using VS2003, c# to build a desktop application
thanks for time and help

Jan 30 '07 #1
10 1475
"xxxx" <xx******@gmail .comwrote in message
news:11******** **************@ a75g2000cwd.goo glegroups.com.. .
so any ideas??
Use the filespec as the Value property of the ListItem and use the filename
as the Text property of the ListItem.
Jan 30 '07 #2
Could you not populate the Tag Property and read it from there?



"xxxx" <xx******@gmail .comwrote in message
news:11******** **************@ a75g2000cwd.goo glegroups.com.. .
Hi all,

i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.

the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.

so any ideas??

i'm using VS2003, c# to build a desktop application
thanks for time and help

Jan 30 '07 #3
i tried using the listitem, but it was not defined.
i guess its applicable for asp.net applications only, i'm trying to
build a desktop application.

On Jan 30, 1:29 pm, "Mark Rae" <m...@markNOSPA Mrae.comwrote:
"xxxx" <xxxxl...@gmail .comwrote in messagenews:11* *************** ******@a75g2000 cwd.googlegroup s.com...
so any ideas??Use the filespec as the Value property of the ListItem and use the filename
as the Text property of the ListItem.
Jan 30 '07 #4
as long as i know, this Tag property is related to the listbox itself,
not to an item in the list, am i wrong??
On Jan 30, 1:28 pm, "iKiLL" <i...@NotMyEmai l.comwrote:
Could you not populate the Tag Property and read it from there?

"xxxx" <xxxxl...@gmail .comwrote in messagenews:11* *************** ******@a75g2000 cwd.googlegroup s.com...
Hi all,
i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.
the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.
so any ideas??
i'm using VS2003, c# to build a desktop application
thanks for time and help- Hide quoted text -- Show quoted text -
Jan 30 '07 #5
In addition to the other comments, you probably want to take a look at
Path.GetFileNam e instead of all that substring "stuff":

http://msdn2.microsoft.com/en-us/lib...tfilename.aspx

Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"xxxx" wrote:
Hi all,

i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.

the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.

so any ideas??

i'm using VS2003, c# to build a desktop application
thanks for time and help

Jan 30 '07 #6
"xxxx" <xx******@gmail .comwrote in message
news:11******** *************@s 48g2000cws.goog legroups.com...
>i tried using the listitem, but it was not defined.
i guess its applicable for asp.net applications only, i'm trying to
build a desktop application.
You can use the ListItem object from the System.Web.UI.W ebControls namespace
in a dektop application - it's just another part of the Framework. I do this
all the time...

MyListItem = new System.Web.UI.W ebControls.List Item();

etc.
Jan 30 '07 #7


On 30 Jan., 12:20, "xxxx" <xxxxl...@gmail .comwrote:
Hi all,

i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.

the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.

so any ideas??

i'm using VS2003, c# to build a desktop application

thanks for time and help
The Tag property is on all controls. It is not used by the framework,
it is meant to be used for user data. So when you populate your
ListView, you may do it like this:
ListViewItem lvi = new ListViewItem();
lvi.Text = Path.GetFileNam e(fullPath);
lvi.Tag = fullPath;
listView1.Items .Add(lvi);

-but it is good style to create a small class for your purpose similar
to this:
private class FolderListViewT ag {
public string Path;

public override string ToString() {
return Path.GetFileNam e(Path);
}
}
-and then put instances of this one into the Tag property. Then,
later, when you find out you need more data, or you need to alter the
string representation of each ListViewItem or you need to make it
configurable, or whatever, then it will require a minimal change.

Good luck :o)

Jan 30 '07 #8

thanks for the great help,

but when i try out this piece of code, i don't get my string in the
listbox, instead i get something like ListViewItem:{W ebapplication1}
instead of WebApplication1 :(

On Jan 30, 3:53 pm, "mookid" <mookid8...@gma il.comwrote:
On 30 Jan., 12:20, "xxxx" <xxxxl...@gmail .comwrote:


Hi all,
i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.
the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.
so any ideas??
i'm using VS2003, c# to build a desktop application
thanks for time and helpThe Tag property is on all controls. It is not used by the framework,
it is meant to be used for user data. So when you populate your
ListView, you may do it like this:
ListViewItem lvi = new ListViewItem();
lvi.Text = Path.GetFileNam e(fullPath);
lvi.Tag = fullPath;
listView1.Items .Add(lvi);

-but it is good style to create a small class for your purpose similar
to this:
private class FolderListViewT ag {
public string Path;

public override string ToString() {
return Path.GetFileNam e(Path);
}}-and then put instances of this one into the Tag property. Then,
later, when you find out you need more data, or you need to alter the
string representation of each ListViewItem or you need to make it
configurable, or whatever, then it will require a minimal change.

Good luck :o)- Hide quoted text -- Show quoted text -
Jan 30 '07 #9
So, if it's a ListViewItem, that's a class. You can cast it to type
ListViewItem and get the value from it's properties.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"xxxx" wrote:
>
thanks for the great help,

but when i try out this piece of code, i don't get my string in the
listbox, instead i get something like ListViewItem:{W ebapplication1}
instead of WebApplication1 :(

On Jan 30, 3:53 pm, "mookid" <mookid8...@gma il.comwrote:
On 30 Jan., 12:20, "xxxx" <xxxxl...@gmail .comwrote:


Hi all,
i need some help here plz :)
i'm building a small application that will dispaly a list of folders
in a listbox, but i only want to display the folder name rather than
the whole path, so i take the substring from the whole path and add it
to the listbox.
the problem is, later, when the user selects to do anything with this
file, i want to get the whole path back(mandatory) , but now i only
have the the name and not the path.
the dummy solution i do, is to get the index of the selected index and
then get the path from teh path list at that index, but i don't like
such a solution, i think its not professional nor efficient.
so any ideas??
i'm using VS2003, c# to build a desktop application
thanks for time and helpThe Tag property is on all controls. It is not used by the framework,
it is meant to be used for user data. So when you populate your
ListView, you may do it like this:
ListViewItem lvi = new ListViewItem();
lvi.Text = Path.GetFileNam e(fullPath);
lvi.Tag = fullPath;
listView1.Items .Add(lvi);

-but it is good style to create a small class for your purpose similar
to this:
private class FolderListViewT ag {
public string Path;

public override string ToString() {
return Path.GetFileNam e(Path);
}}-and then put instances of this one into the Tag property. Then,
later, when you find out you need more data, or you need to alter the
string representation of each ListViewItem or you need to make it
configurable, or whatever, then it will require a minimal change.

Good luck :o)- Hide quoted text -- Show quoted text -

Jan 30 '07 #10

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

Similar topics

5
2640
by: mr.iali | last post by:
Hi Everyone I would like to get into software developent using a programming language like c++, java or pl/sql for oracle. I have no idea where to start from. Which language is there more demand for. Looking at jobs there seems to be a better chance in getting a java job rather than a oracle or c++ job. Also is java and oracle a good...
4
1839
by: nsr93 | last post by:
I am not sure if this was the proper group to post this, but here is my question: I am a Java consultant. I have new client I am working for to make a web based application similar to an ecommerce site. We aren't selling anything but we have a notion of a cart where you add schedule items. You can perform actions such as add/edit/remove...
6
1996
by: Martijn van Oosterhout | last post by:
I've had some fun in the past where I've had to grant a lot of tables and other similar system commands. Unfortunatly, you can't use queries to fill in fields for you. Anyway, I've implemented a patch which allows the following: grant select on ":2" to ":1" \for select usename, relname from pg_catalog.pg_user, pg_catalog.pg_class where...
19
4072
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can...
48
3195
by: Chad Z. Hower aka Kudzu | last post by:
A few of you may recognize me from the recent posts I have made about Indy <http://www.indyproject.org/indy.html> Those of you coming to .net from the Delphi world know truly how unique and "huge" Indy is both as a project, in support, development, and use. But Indy is new to the .net world. Indy is a HUGE library implementing over 120...
15
4571
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never...
4
2194
by: robinsand | last post by:
My apologies to those of you who are more advanced Visual C++ .NET programmers, but I am working on a project for an MBA course that is condensed into an eight-week schedule, and I need help getting a program up and running with proper files and documentation to be handed in for a grade (on Microsoft Visual Studio .NET 2003). I am being...
46
2495
by: Bruce W. Darby | last post by:
This will be my very first VB.Net application and it's pretty simple. But I've got a snag in my syntax somewhere. Was hoping that someone could point me in the right direction. The history: My work involves creating custom packages of our software product for golf courses that purchase our software. The course data is kept as a back up in...
20
4232
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black...
7
2282
by: elgiei | last post by:
Good morning at all, i have to implement a server,that every n-seconds (eg. 10sec) sends to other clients,which files and directory has been deleted or modified. i build a n-tree, for each files on harddisk there's a node into n- tree, this solution is not good for large hard disk.. and i can't use inotify (it's forbidden), and only c...
0
7406
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...
0
7813
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...
1
7431
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...
0
7761
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...
0
5976
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...
0
3457
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...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
709
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...

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.