|
-
Jul 26th, 2003, 09:02 PM
#1
3 Quick questions (hopefully)
I got 3 questions.
1. With my program, I get the filename from the file and store it in a string after they open it and after they use Save As. My question is, how can I get JUST the filename like when I get the entire file it will show the directories under it, I just want like "file.txt" and not "C:\file.txt". Also, how could I just get what extension is on it?
2. I created a new form for a preferences dialog. I was wondering, how could I use a treeview to display things on the dialog? I don't want to put 10 things on each group and have like 10 groups then hide them all and show 1 when clicking on a tree, because then it would be A MESS to edit and change things.
3. I want to draw a line on a textbox. How can I do that? I want it to be exactly on a margin that doesn't exist. Like say I want a red line to be drawn on margin 800 even though the text box will go past that. how
Okay, after this I doubt I'll have any questions for a good while. I posted to see what you guys recommend and see what the best/better ways are, however, I am also searching/looking for solutions too
-
Jul 26th, 2003, 10:32 PM
#2
Frenzied Member
Here is something you can use for #1
VB Code:
Sub FileInformation()
Dim formOfd As New OpenFileDialog
If (formOfd.ShowDialog() = DialogResult.OK) Then
Dim fileInfo As New FileInfo(formOfd.FileName)
MessageBox.Show("File name is " & fileInfo.Name)
MessageBox.Show("Extension is " & fileInfo.Extension)
MessageBox.Show("Full name is " & fileInfo.FullName)
MessageBox.Show("File size is " & fileInfo.Length.ToString())
End If
End Sub
-
Jul 26th, 2003, 11:06 PM
#3
EDIT: Nevermind, I got it.
#1 solved, any takers on 2 and 3?
Last edited by Kasracer; Jul 26th, 2003 at 11:15 PM.
-
Jul 27th, 2003, 01:20 AM
#4
You can also do #1 using the Path object:
VB Code:
Dim p As String = Application.ExecutablePath
MsgBox(IO.Path.GetFileName(p))
I don't understand what you are asking in #2.
In #3 you might have to make your own textbox and inherit from the default Textbox then override the OnPaint event. Thats really just a guess though.
-
Jul 27th, 2003, 01:32 AM
#5
Member
Go Tabs!!! Beat the TreeViews!! GOAL!!!!
im not sure about working with treeview. In my experience, treeview is only good for ppl who really know how to use it, and as far as i can tell, very few ppl actually know how to use it. so would recommend trying to use a tab control. I find that tabs can be extremely useful and a valuable tool no matter what your application is about
-
Jul 27th, 2003, 08:09 AM
#6
Sleep mode
Also for #1 , this code will show file name stored in specific folder :
VB Code:
Dim dir As New IO.DirectoryInfo("c:\windows")
Dim fils() As IO.FileInfo = dir.GetFiles()
Dim i As Integer
For i = 0 To fils.Length - 1
MessageBox.Show(fils(i).Name)
Next
for #2 ,I'm not sure of what you're trying to say , put your controls on a panel or groupbox and hide each group of controls at runtime or hide/show all of them . Or , better you use tabs as UConnVendetta suggested .
for #3 , try this , paste a label with the height = 1 , width =any # , and align it to the textbox which you're doing some effects on .
-
Jul 27th, 2003, 11:00 AM
#7
Originally posted by Pirate
Also for #1 , this code will show file name stored in specific folder :
for #2 ,I'm not sure of what you're trying to say , put your controls on a panel or groupbox and hide each group of controls at runtime or hide/show all of them . Or , better you use tabs as UConnVendetta suggested .
for #3 , try this , paste a label with the height = 1 , width =any # , and align it to the textbox which you're doing some effects on .
I've got #1 figured out now, thanks.
#2 I was wanted to go with a preferences dialog similar to mIRC's where you choose a control on the tree and it shows those controls. Hiding and showing controls while working with it would be a pain in the ass! I'll probably end up using tabs.....
#3 I don't think your method would work because I want it to be like a background for the textbox. I want the words and things within the textbox to show over top of the line.... I was thinking of making the background white on my form, make the textbox transparent and drawling the line but I'm having trouble trying to position the line in the correct place since I'm going off the margin.
-
Jul 27th, 2003, 11:21 AM
#8
I just realied that rich text boxes won't allow a transparent background... UGH!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|