Results 1 to 6 of 6

Thread: Resolved

  1. #1

    Thread Starter
    New Member joshi_nitin's Avatar
    Join Date
    Jan 2005
    Posts
    7

    Exclamation Resolved

    ok....one more..

    I've created a .vb file in that i have some functions..for database...
    i need to call taht function from my aspx file's button (in this file i'm having a button.on that button's click event i want to call that .vb file function) how can i do this...

    Thanx!!!
    Last edited by joshi_nitin; Feb 10th, 2005 at 05:24 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Calling a .vb file function!!

    Instantiate an object of that VB file's class, then the object will expose the function to you.

  3. #3

    Thread Starter
    New Member joshi_nitin's Avatar
    Join Date
    Jan 2005
    Posts
    7

    Exclamation Re: Calling a .vb file function!!

    ok...That nice...!!!! but...i have take values from that aspx page..(from text box)..so how i call those text boxes in .vb file..i' just giving my ROUGH code here of .vb file...
    --------------------------------------------------------------------------
    Public Function insert()
    Dim sqlConn As SqlConnection
    Dim sqlCmd As SqlCommand
    Dim sqlCmd2 As SqlCommand


    sqlConn = New SqlConnection("data source=SHANTASOFTDC;persist security info=False;user id=root;")
    sqlConn.Open()
    sqlCmd = New SqlCommand("Insert User_login_info(username,password,user) values('" & tbox3 & "','" & tbox4 & "','User')", sqlConn)
    sqlCmd2 = New SqlCommand("Insert User_detail_info(firstname,lastname,phone,street,city,state,zip,country,Othercont)values('" & tbox1 & "','" & tbox2 & "','" & tbox6 & "','" & tbox7 & "','" & tbox8 & "','" & tbox9 & "','" & tbox10 & "','" & tbox11 & "')", sqlConn)
    sqlCmd.ExecuteNonQuery()
    sqlCmd2.ExecuteNonQuery()
    sqlConn.Close()
    ------------------------------------------------------

    Thanx!!!

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Calling a .vb file function!!

    You'll have to change it. Make the insert() function accept arguments. Make this whole thing a class.

    From the ASP.NET page's codebehind, instantiate an object of that class, and then call it like:

    Code:
    objectname.insert(TextBox1.Text, textbox3.Text, TextBox7.Text)

  5. #5

    Thread Starter
    New Member joshi_nitin's Avatar
    Join Date
    Jan 2005
    Posts
    7

    Talking Re: Calling a .vb file function!!

    Thanx!!!!!
    SAHI HAI BIDU!!!

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Calling a .vb file function!!

    Add [Resolved] To the thread title.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width