Results 1 to 8 of 8

Thread: 3 Quick questions (hopefully)

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    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

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Here is something you can use for #1
    VB Code:
    1. Sub FileInformation()
    2.         Dim formOfd As New OpenFileDialog
    3.  
    4.         If (formOfd.ShowDialog() = DialogResult.OK) Then
    5.             Dim fileInfo As New FileInfo(formOfd.FileName)
    6.             MessageBox.Show("File name is " & fileInfo.Name)
    7.             MessageBox.Show("Extension is " & fileInfo.Extension)
    8.             MessageBox.Show("Full name is " & fileInfo.FullName)
    9.             MessageBox.Show("File size is " & fileInfo.Length.ToString())
    10.         End If
    11. End Sub

  3. #3

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    EDIT: Nevermind, I got it.

    #1 solved, any takers on 2 and 3?
    Last edited by Kasracer; Jul 26th, 2003 at 11:15 PM.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can also do #1 using the Path object:
    VB Code:
    1. Dim p As String = Application.ExecutablePath
    2.         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.

  5. #5
    Member UConnVendetta's Avatar
    Join Date
    Jul 2003
    Location
    Madison, CT, USA
    Posts
    36

    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
    Jazzman Will Rosenberg
    Chief Admin of [Vendetta]
    http://vendetta.n3.com
    AIM: UConnVendetta, CollegeGuy184

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Also for #1 , this code will show file name stored in specific folder :

    VB Code:
    1. Dim dir As New IO.DirectoryInfo("c:\windows")
    2.         Dim fils() As IO.FileInfo = dir.GetFiles()
    3.  
    4.         Dim i As Integer
    5.  
    6.         For i = 0 To fils.Length - 1
    7.             MessageBox.Show(fils(i).Name)
    8.         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 .

  7. #7

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    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.

  8. #8

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    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
  •  



Click Here to Expand Forum to Full Width