What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » VB/Web Help

VB/Web Help
Author: Message:
DragonX
Full Member
***

Avatar

Posts: 226
Reputation: 10
40 / Male / –
Joined: Aug 2005
O.P. RE: VB/Web Help
Sorry for the double post, just thought it would be better this way

Ok, so here is my code
code:
Public Class miniSearch
    Inherits System.Windows.Forms.Form
    Private URLString As String
    Private Declare Function ShellExecute Lib "SHELL32" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    Private Sub txtSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearch.Click
        If txtSearch.Text = "Enter search words here" Then
            txtSearch.Text = ""
        End If
    End Sub

    Private Sub txtSearch_KeyPress(ByVal KeyAscii As Integer)
        If KeyAscii = 13 Then
            cmdSearch.PerformClick()
        ElseIf KeyAscii = 27 Then
            End
        End If
    End Sub

    Private Sub cmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSearch.Click
        URLString = "http://www.google.ca/search?q=" & Replace$(txtSearch.Text, " ", "+")
        ShellExecute(0&, vbNullString, URLString, vbNullString, vbNullString, vbNormalNoFocus)
        MsgBox(URLString)
        End
    End Sub
End Class


First off, the "cmdSearch.PerformClick()" doesn't work, in fact the whole KeyPress part doesnt' work. I tried sending my KeyPress into a msgBox and that doesn't even work, could it be because i don't ahve a hangle on it ? :S

Edit: OK, i tried with a handle "Handles txtSearch.KeyPress" and i get this error: "Method 'txtSearch_KeyPress' cannot handle Event 'KeyPress' because they do not have the same signature."

Edit2: Alright, after some digging, i found out the KeyPress was redefined in .NET. And to make it work, u need code that looks like this
code:
Private Sub txtSearch_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSearch.KeyPress
        Dim KeyAscii As Integer

        KeyAscii = AscW(e.KeyChar)     <-- This is the code to make it work

        If KeyAscii = 13 Then
            cmdSearch.PerformClick()
        ElseIf KeyAscii = 27 Then
            End
        End If
    End Sub

So that thing is solved :)

And second, it doesn't the launch my browser. Maybe i just overlooked something *-)
Edit: Woohoo, i got it wo work :) by bypassing the API too ;) Here's how i did it
code:
System.Diagnostics.Process.Start(URLString)

Well all works now :D Once it'll all finalized and what not i'll post it here, if anyone wants it ;)

This post was edited on 10-04-2005 at 09:16 PM by DragonX.
[Image: dsd-mi_616175.png]
10-04-2005 07:52 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
VB/Web Help - by DragonX on 10-04-2005 at 07:11 AM
RE: VB/Web Help - by rav0 on 10-04-2005 at 09:44 AM
RE: VB/Web Help - by brian on 10-04-2005 at 10:22 AM
RE: VB/Web Help - by CookieRevised on 10-04-2005 at 03:52 PM
RE: VB/Web Help - by Stigmata on 10-04-2005 at 04:14 PM
RE: VB/Web Help - by CookieRevised on 10-04-2005 at 04:26 PM
RE: VB/Web Help - by Mike on 10-04-2005 at 04:29 PM
RE: RE: VB/Web Help - by CookieRevised on 10-04-2005 at 04:49 PM
RE: VB/Web Help - by DragonX on 10-04-2005 at 07:48 PM
RE: VB/Web Help - by DragonX on 10-04-2005 at 07:52 PM
RE: VB/Web Help - by Ezra on 10-05-2005 at 02:28 PM
RE: RE: VB/Web Help - by CookieRevised on 10-05-2005 at 03:33 PM
RE: VB/Web Help - by YottabyteWizard on 10-05-2005 at 04:15 PM
RE: VB/Web Help - by segosa on 10-05-2005 at 07:19 PM
RE: RE: VB/Web Help - by CookieRevised on 10-05-2005 at 09:48 PM
RE: VB/Web Help - by Ezra on 10-05-2005 at 07:23 PM
RE: VB/Web Help - by YottabyteWizard on 10-05-2005 at 08:08 PM
RE: VB/Web Help - by DragonX on 10-05-2005 at 09:00 PM
RE: VB/Web Help - by YottabyteWizard on 10-06-2005 at 04:44 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On