Lm th? no ? B?t ?u tr?nh duy?t Internet m?c ?nh l?p tr?nh b?ng cch s? d?ng Visual C#

D?ch tiu ? D?ch tiu ?
ID c?a bi: 305703 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Bi vi?t t?ng b?c ny cho b?n th?y lm th? no ? B?t ?u tr?nh duy?t Internet m?c ?nh.

Yu c?u

  • Microsoft Visual Studio.NET

Ch? ?nh URL, FTP ho?c File ? m?

B?n c th? ch? ?nh m?t URL, m?t t?p ho?c ?a ch? FTP. T?t c? ba c?a cc bi t?p l h?p l?:
   string target= "http://www.microsoft.com";
   string target = "ftp://ftp.microsoft.com";
   string target = "C:\\Program Files\\Microsoft Visual Studio\\INSTALL.HTM";  
				

S? d?ng cc phng php qu tr?nh l?p B?t ?u ? kh?i ?ng tr?nh duy?t

Giai c?p ti?n tr?nh ch?a m?t t?nh B?t ?u phng php. B?i v? y l m?t phng php t?nh, b?n c th? g?i B?t ?u m khng c?n m?t th? hi?n c?a m?t t?ng l?p qu tr?nh .
System.Diagnostics.Process.Start(target);
				

Cung c?p x? l? ngo?i l?

B?i v? b?n chi?m u th? c?a b?t ?ng s?n UseShellExecute m?c ?nh khi b?n g?i phng php B?t ?u , b?n khng ph?i m?t cch r? rng truy v?n registry ? xc ?nh tr?nh duy?t l m?c ?nh. Tuy nhin, n?u b?n s? d?ng cch ti?p c?n ny trn m?t my tnh m khng c m?t tr?nh duy?t ?c ci ?t chuyn bi?t, m?t ngo?i l? loi ny. Ngo?i l? ny ph?i ?c b?t g?p do hnh ?ng thch h?p c th? ?c th?c hi?n.

V d? ny m?t cch r? rng b?y cho m?t l?i ?c t?o ra khi kha registry c?n thi?t khng ?c t?m th?y v ch? ra r?ng khng c tr?nh duy?t ?c ci ?t chuyn bi?t. Ngoi ra, m?t x? l? ngo?i l? chung cung c?p cho cc l?i c th? x?y ra. Try... catch block ?c th? hi?n trong danh sch m? hon ch?nh.

Hon thnh m?u m?

    string target= "http://www.microsoft.com";
    //Use no more than one assignment when you test this code. 
    //string target = "ftp://ftp.microsoft.com";
    //string target = "C:\\Program Files\\Microsoft Visual Studio\\INSTALL.HTM"; 

    try
        {
         System.Diagnostics.Process.Start(target);
        }
    catch
        ( 
         System.ComponentModel.Win32Exception noBrowser) 
        {
         if (noBrowser.ErrorCode==-2147467259)
          MessageBox.Show(noBrowser.Message);
        }
    catch (System.Exception other)
        {
          MessageBox.Show(other.Message);
        }
				

Gi?i p th?c m?c

M? ny l ph? thu?c nhi?u vo cc Hi?p h?i ki?u t?p tin ?ng d?ng trong HKEY_LOCAL_MACHINE hive c?a s? ki?m nh?p. i?u ny c th? d?n ?n k?t qu? b?t ng? v ngo?i l? n?u s? ki?m nh?p b? h?ng. Ngoi ra, loai tp v ph?n m? r?ng c th? ?c k?t h?p v?i cc ?ng d?ng khc v?i tr?nh duy?t. V d?, t?p HTM ho?c HTML c th? ?c k?t h?p v?i Web pht tri?n ph?n m?m thay v? c?a tr?nh duy?t.

TI LI?U THAM KH?O

? bi?t thm chi ti?t v? qu tr?nh l?p, gh thm Web site sau c?a Microsoft:
Qu tr?nh l?p

Thu?c tnh

ID c?a bi: 305703 - L?n xem xt sau cng: 19 Thang Sau 2012 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# 2005
T? kha:
kbhowtomaster kbprod2web kbmt KB305703 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny: 305703

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com