views:

64

answers:

2

Stupid question I know but how do i create one? All i need it to do is open up a dialog box and populate the text box next to it

+1  A: 

You need to use the OpenFileDialog (silverlight 2.0). There are plenty examples kicking around or I am a big fan of Video Demo's example 2.

cgreeno
+2  A: 

If I understand correctly you are asking only about putting a user-selected filename into a TextBox control next to a button. You are NOT asking about the actual uploading of the file. If this is correct, then my answer is that you can do this:

        OpenFileDialog dlg = new OpenFileDialog();
        dlg.Multiselect = false;
        if (dlg.ShowDialog() == true)
        {
            yourTextBox.Text = dlg.File.Name;
            // Read stream of data from file, etc.
        }

You can't show the full path which would have been available via dlg.File.FullName due to security restrictions in Silverlight.

Clay Fowler