BBNuno

Hi! I need to put a ballon tip on a webbrowser1, for exemplo i put a webbrowser on my form and i make it go to www.google.com and when the page is loaded i need to put a ballon on the text box with something....and i need this for others text boxs or buttons!

Can someone help



Re: Visual Basic Language Ballon tip on WebBrowser Form

ahmedilyas

You cant really place a Balloon Tip on the browser but on the form.

Implement the Navigated event on the browser control, this will fire everytime a page has been navigated to. Then in this event, simply set the balloon tip text to the WebBrowserNavigatedEventArgs parameter :

Me.toolTip.SetText(Me.textBox, e.Uri.ToString()) 'returns the URL its navigated to

Does this help






Re: Visual Basic Language Ballon tip on WebBrowser Form

BBNuno

Hummm....The question is how to put ballon tips on page loaded in the webbrowser form Like this image -> http://img462.imageshack.us/img462/5745/semttulogf2.gif







Re: Visual Basic Language Ballon tip on WebBrowser Form

ahmedilyas

The above code does that.

Just remember to set the IsBalloon property of the tooltip to true

The SetText(control, text) will set the text to that control given and will show the Balloon if you set the IsBalloon property to true.






Re: Visual Basic Language Ballon tip on WebBrowser Form

BBNuno

Can you help with some more especifiq I am portuguese and i search for this so mch...help...lol





Re: Visual Basic Language Ballon tip on WebBrowser Form

ahmedilyas

Say we have a textbox on the form.

From a button or some other event, we need to create a tooltip for that control

Dim myTooltip as new ToolTip()

myTooltip.IsBalloon = true

myTooltip.SetToolTip(Me.textbox1, "This is the main text")

myTooltip.Show("Title", Me.textbox1)

Thats all there is to it.






Re: Visual Basic Language Ballon tip on WebBrowser Form

kleinma

Sounds to me like the thread starter wants to show balloon tips that are "stemming" from HTML controls in the webpage that he navigates to, not set a balloon tip on some win forms control...

This is possible, however you would need to track x/y locations for controls in the browser itself, so you can position the balloons properly.

Also I would think the DocumentComplete is a better event to run this code, as this event fires when the page has completed loading. The navigated event fires as soon as you navigate to a site.






Re: Visual Basic Language Ballon tip on WebBrowser Form

BBNuno

yah...i understand that but the text boxs or butons are loaded on the webbrowser component! What i need to do to tell it the ballon here is the position of the text box





Re: Visual Basic Language Ballon tip on WebBrowser Form

BBNuno

With this code i get the all elements of the html page:

On Error Resume Next
X = 0
For X = 0 To WebBrowser1.document.Forms.Length - 1
For I = 0 To WebBrowser1.document.Forms(X).Length - 1
txtCode.Text = txtCode.Text & "Frame: " & X & " Elemento: " & I & vbCrLf
txtCode.Text = txtCode.Text & "Nome: " & WebBrowser1.document.Forms(X)(I).Name & vbCrLf
txtCode.Text = txtCode.Text & "Tipo: " & WebBrowser1.document.Forms(X)(I).Type & vbCrLf
txtCode.Text = txtCode.Text & "Valor: " & WebBrowser1.document.Forms(X)(I).Value & vbCrLf
txtCode.Text = txtCode.Text & vbCrLf
Next I
txtCode.Text = txtCode.Text & "===================" & vbCrLf
DoEvents
Next X

Ití»s possible tell a ballon tips to open on a "WebBrowser1.document.Forms(X)(I).Name"





Re: Visual Basic Language Ballon tip on WebBrowser Form

ahmedilyas

In that case, its not possible as its HTML content and your form is a different type of content.(you cant add a form based component to an html based component - different platforms)

In addition, you need to use the classes in the .NET Framework rather than old VB code. On error resume next is really bad practice, and you should replace that with a try catch block and handle the exception. As well as that, dont use VBCRLF but instead use Enviroment.NewLine

Also avoid using DoEvents, its unsafe and bad practice and can result in unpredicatable results at times.






Re: Visual Basic Language Ballon tip on WebBrowser Form

BBNuno

grrr...but i see a program that can make this...and its made in vb...





Re: Visual Basic Language Ballon tip on WebBrowser Form

ahmedilyas

It maybe using some jscript in the background and making that effect. The Balloon/tooltip control is a WinForms control and is only used on the WinForms application, you can't associate that to another type of control/application.






Re: Visual Basic Language Ballon tip on WebBrowser Form

BBNuno

so can i detect some word on html code and put another code before that ex.javascr, and when page is loaded apear my ballon





Re: Visual Basic Language Ballon tip on WebBrowser Form

kleinma

ahmedilyas wrote:

It maybe using some jscript in the background and making that effect. The Balloon/tooltip control is a WinForms control and is only used on the WinForms application, you can't associate that to another type of control/application.

That isn't 100% accurate

While it is true you can't mix and match win forms control and HTML content simply because you plop a webbrowser control in your windows form, that doesn't mean its impossible to get the relative x/y coords of HTML elements and then show tool tips.

That being said, nothing is impossible in programming. I messed around for about 20 minutes and came up with this example project, which illustrates navigating to google.com, and then allows you to show a balloon tip at the x/y coord of the search box.

Now this likely is not a 100% every situation working example, but it does show it is most certainly possible.

I event implemented code that keep the balloon tip showing correctly if the form is moved or resized...

here is the source code for the sample project in ZIP format. I remove the OBJ and BIN folders so there is no compiled code. So when you open the .sln file, rebuild or run the project.

http://www.zerosandtheone.com/examples/WebbrowserBalloonTips.zip






Re: Visual Basic Language Ballon tip on WebBrowser Form

ahmedilyas

i dont think you can as it wouldve already executed the page and javascript already.

You could re-write it and then write to disk then navigate to that file so it runs and loads the modified file but that is very inefficient and useless.