Identifier

Public Sub ()

RaiseEvent Button2.Click(TextBox2.Text & TextBox3.Text)

End Sub

It says i need a identifier before () on Public Sub (), but im not sure wut i need to do. Can someone post the correct code




Answer this question

Identifier

  • paulta

    What is you sub called. What its telling you is that you need to give your sub a name. You cant just leave it blank. How would you then be able to refer to this sub

    Example

    Public Sub XYZ()
    RaiseEvent Button2.Click(TextBox2.Text & TextBox3.Text)
    End Sub


  • nirbhay194133

    Still let the forum know how what you were trying to do and what the problem was - it may help others.


  • Gr&#233&#59;gory Leandro

    nvm i think i figured it out

  • Scrat

    thx though

  • Alan Jackson

    aight i understand it now, i dont know what the StrMessage is though, is that like a promp for a TextBox, and what does the My prefix mean.

  • Jim Wooley

    A couple of bits of advice. If something is not clear then provide more information and ask again - the people here want to help you get a good result. If we had other things to do - we dont respond. If we do respond its because we want to help.

    Still a little unclear from your description about why we need to save it or where we want to save it to. but the code should be something similar to the following

    Public Class Form1
    Private Const DefaultAIMText As String = "aim:goim screenname="
    Private StrMessage As String '//Used to store the message - Not really need unless you want to store the string for some other purpose.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.TextBox2.Text = DefaultAIMText
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    '//Create a new string in the module variable StrMessage consisting of default message and Textbox3 contents
    StrMessage = DefaultAIMText & TextBox3.Text

    'Displays the updated message in the textbox2
    Me.TextBox2.Text = StrMessage
    End Sub
    End Class

    This code has comments in and current stores the message/string to a variable but thats really because I didnt know where or why you need to save it.


  • Hercules

    well i didnt really figure out what i needed to do lol, i just figured u had other things to do and didnt wana keep bothering you.

    But if u want to know, i was making a prorgam that you can make buttons that have TextBox2.Text as "aim:goim screenname=" and TextBox3.Text as a box where you type in the screen name then when you click a button it saves aim:goin screenname=TextBox3.Text as that buttons function and when you click it later it brings up the aim chat. Its just for practicing since im kinda new to it. But thats what i was trying to do.



  • k.Rahul

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    End Sub

    Public Sub ()

    RaiseEvent Button2.Click(TextBox2.Text & TextBox3.Text)

    End Sub

    End Class

    This this



  • mortenmort

    I was only using strmessage as a way of storing the string that I was displaying. You'll notice there is a line that says

    Private StrMessage as string

    This is defining a private module level string variable which I can store the message that I have displayed in. It may not be needed but as you mentioned saving in your original description of the problem I put this in but I could easily eliminate it if you describe more full what you mean by saving.

    Be careful about your syntax. I used ME and not MY in the example. They have different meanings in the VB Language

    The Me keyword is used any time we want our code to refer to methods within the current object.


  • OdieTurbo

    You still havent given an identifier for the line Public Sub ()

    From what I can see you have an event handler established that will cause Button2_Click method to be called when the button2.click event occurs.

    I'm not sure what you trying to achieve in the sub. What are you trying to do....

    Please provide a description of what you are trying to achieve with the code and we can help you.


  • Identifier