Results 1 to 2 of 2

Thread: CommonDialog Conversion [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member Rattlerr's Avatar
    Join Date
    Jul 2005
    Location
    FloralCity,Florida
    Posts
    269

    Resolved CommonDialog Conversion [RESOLVED]

    I need some help with syntex for the CommonDialog I know "With" isnt used in C# but i'm converting an old VB6 App to the C#.NET 2005

    VB Code:
    1. With CommonDialog
    2.   .Filename = ""
    3.   .DialogTitle = "Load bots List"
    4.   .Filter = "All Supported Types|*.txt"
    5.   .ShowOpen
    6.    If .FileName = "" Then Exit Sub

    If someone could help me convert this I'd appreciate it..Been trying too look it up on msdn with no luck..thxs in advance
    Last edited by Rattlerr; Jan 31st, 2006 at 12:55 AM.

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: CommonDialog Conversion

    I haven't done vb6 but as what I've understand I think commondialog class was replace in .net w/ filedialog.
    Code:
    OpenFileDialog openFileDialog1 = new OpenFileDialog();
    
        openFileDialog1.InitialDirectory = "c:\\" ;
        openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
        openFileDialog1.FilterIndex = 2 ;
        openFileDialog1.RestoreDirectory = true ;
    
        if(openFileDialog1.ShowDialog() == DialogResult.OK)
        {
          if(openFileDialog1.Filename=="")
    {
    //do something
    }
    else
    {
    //do something
    }
        }

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