Search code examples
c#textbox

Path only on textbox


Is it possible to enter only a File path in textbox using c# (windows application)? Just like the function (IsNumeric) that will only allow the numbers only in textbox. How should I do that?


Solution

  • There are two properties of TextBox you can make use of

    textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
    textBox1.AutoCompleteSource = AutoCompleteSource.FileSystem;
    

    This will make your textbox to provide suggestions while you type a path