10 Replies - 732 Views - Last Post: 30 March 2010 - 02:28 PM Rate Topic: -----

#1 vlogger3000  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 11
  • Joined: 28-March 10

URL bar issue...

Posted 28 March 2010 - 06:30 PM

I'm making a web browser, just got started with programming. I want the URL bar to do the same thin on enter as when you press the Go button (code is below:

        Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
    End Sub



This is the URL bar code:

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If e.KeyChar = Chr(13) Then
            Button1_Click(Me, EventArgs.Empty)
        End If
    End Sub



and this is the error I get every time i press F5

Error	1	'KeyChar' is not a member of 'System.EventArgs'.



im new so please tell me EXACTLY watc to change. assume little knowledge.

Is This A Good Question/Topic? -1
  • +

Replies To: URL bar issue...

#2 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: URL bar issue...

Posted 28 March 2010 - 06:56 PM

:no: :no: :no: :no: :no: :no: :no:
vb.net forum
Was This Post Helpful? 0
  • +
  • -

#3 vlogger3000  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 11
  • Joined: 28-March 10

Re: URL bar issue...

Posted 29 March 2010 - 11:58 AM

View Postthava, on 28 March 2010 - 05:56 PM, said:

:no: :no: :no: :no: :no: :no: :no:
vb.net forum


why what am i doing wrong?
Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: URL bar issue...

Posted 29 March 2010 - 12:34 PM

To make a button click use:
button1.PerformClick()

You can only use e.KeyChar in a keypress event.
Private Sub Combobox1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles.Combobox1.KeyPress
   If Convert.ToInt32(e.KeyChar) = Keys.Enter Then
      button1.PerformClick()
   End If
End Sub

e.KeyChar -> this is a member of the KeyPressEventArgs

This post has been edited by hawkvalley1: 29 March 2010 - 12:35 PM

Was This Post Helpful? 0
  • +
  • -

#5 vlogger3000  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 11
  • Joined: 28-March 10

Re: URL bar issue...

Posted 29 March 2010 - 03:16 PM

View Posthawkvalley1, on 29 March 2010 - 11:34 AM, said:

To make a button click use:
button1.PerformClick()

You can only use e.KeyChar in a keypress event.
Private Sub Combobox1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles.Combobox1.KeyPress
   If Convert.ToInt32(e.KeyChar) = Keys.Enter Then
      button1.PerformClick()
   End If
End Sub

e.KeyChar -> this is a member of the KeyPressEventArgs


I got the SAME EXACT error.
Was This Post Helpful? 0
  • +
  • -

#6 vlogger3000  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 11
  • Joined: 28-March 10

Re: URL bar issue...

Posted 29 March 2010 - 03:26 PM

Alos if anyone has a code for a Favorites Bar that'd be nice :)
Was This Post Helpful? 0
  • +
  • -

#7 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: URL bar issue...

Posted 29 March 2010 - 04:01 PM

I highly doubt it! And you never mentioned an error, but your code seemed obvious. So what is the error - cause we are not mind readers here!

This post has been edited by hawkvalley1: 29 March 2010 - 04:03 PM

Was This Post Helpful? 0
  • +
  • -

#8 vlogger3000  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 11
  • Joined: 28-March 10

Re: URL bar issue...

Posted 29 March 2010 - 10:50 PM

View Posthawkvalley1, on 29 March 2010 - 03:01 PM, said:

I highly doubt it! And you never mentioned an error, but your code seemed obvious. So what is the error - cause we are not mind readers here!


To quote myself in friggin POST NUMERO UNO:

[quote name='vlogger3000']

and this is the error I get every time i press F5

Error 1 'KeyChar' is not a member of 'System.EventArgs'.

[quote]

THAT error.
Was This Post Helpful? -1
  • +
  • -

#9 myork  Icon User is offline

  • D.I.C Head

Reputation: 41
  • View blog
  • Posts: 129
  • Joined: 04-March 09

Re: URL bar issue...

Posted 29 March 2010 - 11:11 PM

Something's wrong with your event sub, then. Are you still using the combobox selectedindexchanged? If so, that's not what you want. As in hawk's post, you want the keypress event. If you change that, your eventarg param will be ByVal e As KeyPressEventArgs.
Was This Post Helpful? 0
  • +
  • -

#10 Jack Eagles1  Icon User is offline

  • Pugnacious Penguin (inspired by no2pencil)
  • member icon

Reputation: 183
  • View blog
  • Posts: 1,152
  • Joined: 10-December 08

Re: URL bar issue...

Posted 30 March 2010 - 02:22 PM

Use the KeyDown Event. Do it like this:


Private Sub TEXTBOX1_KEYDOWN
If E.KeyCode = Keys.Enter Then
'Your Code Here
End If
End Sub


Was This Post Helpful? 0
  • +
  • -

#11 Lumenii  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 92
  • Joined: 04-January 07

Re: URL bar issue...

Posted 30 March 2010 - 02:28 PM

vlogger3000, the reason your original attempt at a Key-related event didn't work was because it wasn't a Key-related event.

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If e.KeyChar = Chr(13) Then
            Button1_Click(Me, EventArgs.Empty)
        End If
    End Sub



Your event was for the ComboBox1.SelectedIndexChanged event -- which is not an event normally raised by the press of most keys (of course, arrow keys are an exception, but that's not what this is about). As said before, your event should have been a KeyPress or KeyDown event to be able to figure out which key was pressed. It should probably have been the AddressBarTextBox.KeyPress or AddressBarTextBox.KeyDown event.

The 'EventArgs', or Event Arguments for that event are 'System.EventArgs'; generic "System Event Arguments." You would need specific arguments, such as "KeyPressEventArgs", to be able to detect keys pressed which raise the event.

This post has been edited by Lumenii: 30 March 2010 - 02:30 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1