Lm th? no ? s? d?ng tham s? PostData ki?m sot WebBrowser

D?ch tiu ? D?ch tiu ?
ID c?a bi: 174923 - 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

Ki?m sot WebBrowser c m?t phng php i?u h?ng v?i PostData nh m?t tham s?.i?u ny cho php ng?i dng ? g?i d? li?u ?n URL ?c ch? ?nh v?i WebBrowsercontrol.

Thng tin thm

i?u h?ng thng s? k? thu?t:
i?u h?ng cc ngu?n l?c ?c xc ?nh b?i m?t Universal Resource Locator (URL), ho?c cc t?p tin ?c xc ?nh b?i m?t ?ng d?n ?y ?.

C php:
   object.Navigate URL [Flags,] [TargetFrameName,] [PostData,] [Headers]

PostData ty ch?n:

D? li?u g?i ?n my ch? trong cc giao d?ch c?a HTTP bi. V d?: giao d?ch bi ?c s? d?ng ? g?i d? li?u thu th?p b?i m?t h?nh th?c HTML. N?u thisparameter khng xc ?nh b?t k? ng d? li?u, i?u h?ng cc v?n ? phng php anHTTP nh?n ?c giao d?ch. Tham s? ny ?c b? qua n?u URL khng ph?i l m?t URL HTTP.

Lu ?: ng d? li?u ?c ch? ?nh b?i PostData ?c thng qua nh l m?t SAFEARRAYstructure. Cc bi?n th? nn lo?i VT_ARRAY v tr? ?n m?t SAFEARRAY.SAFEARRAY nn lo?i y?u t? VT_UI1, kch th?c, v c anelement ?c tnh b?ng s? byte d? li?u bi.

M?u ? PostData URL h? ph?c v?

  1. B?t ?u Visual Basic. N?u Visual Basic ang ch?y, ch?n d? n m?i t? tr?nh n t?p (ALT, F, N). Form1 ?c t?o ra theo m?c ?nh.
  2. Thm m?t i?u khi?n WebBrowser (WebBrowser1) vo Form1.
  3. Thm m?t CommandButton (Command1) vo Form1.
  4. Thm m? sau y ? cc s? ki?n Command1_Click c?a Form1:
          Sub Command1_Click()
             Dim URL As String
             Dim Flags As Long
             Dim TargetFrame As String
             Dim PostData() As Byte
             Dim Headers As String
             URL = "http://YourServer" ' A URL that will accept a POST
             Flags = 0
             TargetFrame = ""
             PostData = "Information sent to host"
             ' VB creates a Unicode string by default so we need to
             ' convert it back to Single byte character set.
             PostData = StrConv(PostData, vbFromUnicode)
             Headers = "Content-Type: application/x-www-form-urlencoded" & _
             WebBrowser1.Navigate URL, Flags, TargetFrame, PostData, Headers
          End Sub
  5. B?m phm F5 ? ch?y chng tr?nh v cc thng tin trong bi?n PostData s? ?c g?i ?n my ch? ?c ch? ?nh trong tham s? URL.

Thu?c tnh

ID c?a bi: 174923 - L?n xem xt sau cng: 03 Thang Ba 2014 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic 5.0 Control Creation Edition
  • Microsoft Internet Client Software Development Kit 4.01
T? kha:
kbhowto kbmt KB174923 KbMtvi
My d?ch
QUAN TRONG: Bai vit nay c d?ch b?ng phn mm dich thu?t cua Microsoft va co th c Cng ng Microsoft chinh sa l?i thng qua cng ngh CTF thay vi mt bin dich vin chuyn nghip. Microsoft cung c?p cc bi vi?t ?c c? bin d?ch vin v ph?n m?m d?ch thu?t th?c hi?n v c?ng ?ng ch?nh s?a l?i ? 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 nhi?u ngn ng? Tuy nhin, bi vi?t do my d?ch hoc thm chi cng ng chinh sa sau khng ph?i lc no c?ng hon h?o. Cc bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, 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.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny: 174923

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