Attaching Files!!!

sohaib

Well-known member
Joined
Apr 30, 2005
Messages
64
Programming Experience
3-5
Hi guys!!!

I have a problem for attaching files entering into the record....In my scenario, different types of files can be attached it should be done as in Microsoft Outlook or in mailing websites...

The links should be saved into the database for future reference as i will click for viewing those files i will easily get that file open...

I used savefiledialog with linklabel the attached address of the file is easily manageable..... but when i use to save into the database as i put linklabel.text for the path of the file but it's too long as i used savefiledialog.filename...

I have to ask is there any method or any idea so that i used to enter so many files at a time and then enter into the database and name should be display only "sohaib.doc" nothing else i mean not full path....

Can any one give good suggestion for this simple problemm

I hope for the positive suggestion from u ppl soon

Take Care, Bye
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
Ok you can use Split function (path is consisted by slash "\" separated groups of text ... then just find last index and that's it ...

here is an example ... just add button1 and paste this to your experimental project:

VB.NET:
Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] str [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = "E:\myFolder1\myFolder2\bin\myDoc.doc"
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] strAr() [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = str.Split("\")
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] finStr [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2] = strAr.Length - 1
 
MessageBox.Show(strAr(finStr))
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff]

Cheers ;)
 
Last edited:

sohaib

Well-known member
Joined
Apr 30, 2005
Messages
64
Programming Experience
3-5
Hi Kulrom!!

That reply is really kooll..... thnx a lot.....
It has been working very nicely but now i have another problem which i have described in Listview/Treeview Section...

The problem is that i have to maintain a record of Skills with experience in the database ...i m using treeview for sub-division of skills in many cases.... so when parent node is selected all its child items should be selected and when it deselects its child column should be deselected right...selection is working but deselection create errors..
After that i have to enter that skill with experience field into the database and i hope i have to use another table as a person can have so many skills at a time right...

so for entering into the database i have to use all these things as strings or make another table while doing this it is not happening right now....

I have another idea if i will select skills from treeview and then added into the listview with its experience and then both of them added into the database...

Do u have a good suggestion...This is a problem which i m looking for in all the sections with different threads...The combined problem which i have written above...

Hope u will positive suggestion and advice for me
ok
Thnx again in the end
Bye
C U soon
 
Top Bottom