Thank you sooooo much! That was very clear and easy to understand! You should be a teacher of some sort! Thank you!
On Feb 11, 11:18 am, sallushan <[email protected]> wrote: > First take a look at "Dialog Box" we usually see when we try to open a > file from (almost) any software > > http://images.google.com/images?q=openfiledialog > > Therefore in .net framework we have been provided with a component (or > you can say control) i.e. OpenFileDialog. Using this component we can > show the same dialog box to the end user of our application. Note that > you don't have to create the Dialog Box itself. Just call the > "ShowDialog()" member of this class and voilà! > > To use it, we usually drag and drop this component (from Toolbox) on > form. > > http://msdn.microsoft.com/en-us/library/system.windows.forms.openfile... > > On Feb 11, 7:19 pm, Kenny <[email protected]> wrote: > > > Hello, > > > I'm a self-taught programmer, so please bear with me. > > > I'm writing a program where a text file is parsed and each line is > > added to a database. A challenge I'm faced with is the user is going > > to specify a different text file each time. I want to implement a > > button like the Choose File button for attaching a file in a new > > message on Gmail. I've searched Google and I've found many examples > > for ASP pages and a few examples in C# where the person answering the > > question used nomenclature I couldn't understand. I also came across > > many snarky answers. Could someone please explain how to do it in C# > > not using that bizarre "Dim" nomenclature the MSDN library uses? Thank > > you. > > > If it helps, here's an example I could understand and I'll explain > > what confused me. > > > private void button2_Click(object sender, EventArgs e) > > { > > openFileDialog1.ShowDialog(); > > CenariosText.Text = openFileDialog1.FileName; > > } > > > I understand the button2_Click line. I understand CenariosText is the > > name of the text box on the Form. I don't understand what > > openFileDialog1 is. Is it the name of the variable storing the name of > > the file to open? If not, what is it? > > > Thank you!
