Use of openfiledialog

Source: Internet
Author: User

In the past two days, I applied openfiledialog and used the upload function. When I opened the page, a series of operations were far from being implemented by the Asp.net upload control, however, learning is quite useful. The following is a simple application.

// Click the event private void button#click (Object sender, eventargs E) in the browser button) {try {// only the database file openfiledialog1.filter = "database file | *. DB "; if (openfiledialog1.showdialog () = dialogresult. OK) // get import {// when you click the Browse button, rotate the file path filename = openfiledialog1.filename; // put the obtained path in the text box textbox1.text = filename; // obtain the selected file name string name = filename. substring (filename. lastindexof ('\') + 1);} else return;} catch (exception ex) {msgbox. err ("reading data is incorrect. Please check the file to read data again ");}}
View code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.