English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
Todas las categorías

como poner un webbrowser en visual... eske ya se komo acer k abra determinada direccion k escribes en un textbox... pero como le ago para k con un boton me especifique una url?
asi.. k cuando presiones el button1 aparesca la url www.mexico.com
cuando presionas el button2 aparesca C:/misdocumentos/pagina.htm (esta estara en tu pc)

2006-10-05 05:19:43 · 3 respuestas · pregunta de dgr 1 en Ordenadores e Internet Programación y Diseño

3 respuestas

Menu Proyecto->Añadir Formulario->Explorador Web-> open
Quitas los botones que no te gustan y agregas los tuyos

Private Sub cmdbuton1_Click()
WebBrowser1.Navigate ("http://www.mexico.com")
End Sub
Private Sub cmdbuton2_Click()
WebBrowser1.Navigate ("file://c:\misdocumentos/pagina.htm")
End Sub

Te crea un formulario con webrowser t con este codigo:

Option Explicit

Public StartingAddress As String
Dim mbDontNavigateNow As Boolean
Private Sub Form_Load()
On Error Resume Next
Me.Show
tbToolBar.Refresh
Form_Resize

cboAddress.Move 50, lblAddress.Top + lblAddress.Height + 15

If Len(StartingAddress) > 0 Then
cboAddress.Text = StartingAddress
cboAddress.AddItem cboAddress.Text
'try to navigate to the starting address
timTimer.Enabled = True
brwWebBrowser.Navigate StartingAddress
End If

End Sub



Private Sub brwWebBrowser_DownloadComplete()
On Error Resume Next
Me.Caption = brwWebBrowser.LocationName
End Sub

Private Sub brwWebBrowser_NavigateComplete(ByVal URL As String)
Dim i As Integer
Dim bFound As Boolean
Me.Caption = brwWebBrowser.LocationName
For i = 0 To cboAddress.ListCount - 1
If cboAddress.List(i) = brwWebBrowser.LocationURL Then
bFound = True
Exit For
End If
Next i
mbDontNavigateNow = True
If bFound Then
cboAddress.RemoveItem i
End If
cboAddress.AddItem brwWebBrowser.LocationURL, 0
cboAddress.ListIndex = 0
mbDontNavigateNow = False
End Sub

Private Sub cboAddress_Click()
If mbDontNavigateNow Then Exit Sub
timTimer.Enabled = True
brwWebBrowser.Navigate cboAddress.Text
End Sub

Private Sub cboAddress_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = vbKeyReturn Then
cboAddress_Click
End If
End Sub

Private Sub Form_Resize()
cboAddress.Width = Me.ScaleWidth - 100
brwWebBrowser.Width = Me.ScaleWidth - 100
brwWebBrowser.Height = Me.ScaleHeight - (picAddress.Top + picAddress.Height) - 100
End Sub

Private Sub timTimer_Timer()
If brwWebBrowser.Busy = False Then
timTimer.Enabled = False
Me.Caption = brwWebBrowser.LocationName
Else
Me.Caption = "Working..."
End If
End Sub

Private Sub tbToolBar_ButtonClick(ByVal Button As Button)
On Error Resume Next

timTimer.Enabled = True

Select Case Button.Key
Case "Back"
brwWebBrowser.GoBack
Case "Forward"
brwWebBrowser.GoForward
Case "Refresh"
brwWebBrowser.Refresh
Case "Home"
brwWebBrowser.GoHome
Case "Search"
brwWebBrowser.GoSearch
Case "Stop"
timTimer.Enabled = False
brwWebBrowser.Stop
Me.Caption = brwWebBrowser.LocationName
End Select

End Sub

2006-10-06 07:17:14 · answer #1 · answered by Anonymous · 0 0

Private Sub cmdbuton1_Click()
WebBrowser1.Navigate ("http://url1.com")
End Sub
Private Sub cmdbuton2_Click()
WebBrowser1.Navigate ("http://url2.com")
End Sub

2006-10-05 12:29:57 · answer #2 · answered by Ana 6 · 0 0

Te aconsejo buscar en la ayuda.

2006-10-05 12:25:55 · answer #3 · answered by Alex64 3 · 0 0

fedest.com, questions and answers