Accessing a method within a class VB.NET from a Web Form page.

 I got the following class within my App_Code folder under a file called DataAccess.vb:
  Namespace CircaComArtAccess

Public Class ComArtData

Private _connstr As String = System.Configuration.ConfigurationManager.ConnectionStrings("ESQLConn").ConnectionString()

Public Sub ComArtGrid(ByVal procedurename As String, _
ByVal parameters() As SqlParameter, _
ByVal gridname As ComponentArt.Web.UI.Grid, _
ByVal e As ComponentArt.Web.UI.CallBackEventArgs, _
Optional ByVal commandtype As CommandType = 1 _
Dim SQLConn As SqlConnection
SQLConn = New SqlConnection(_connstr)

Dim cmd As SqlCommand = New SqlCommand(procedurename, SQLConn)
Dim dt As New DataTable


With gridname
.DataSource = dt
End With

Catch ex As Exception

End Try

End Sub

End Class
 I am trying to access the method  "ComArtGrid" from my class within a web form page but cant figure out how to access it.
Imports CircaComArtAccess

Partial Class vptest_testClass
    Inherits System.Web.UI.Page

    Dim BindData As ComArtData


End Class
  Any suggestions?

Victor A. Palma
3/15/2007 8:37:39 PM 91979 articles. 4 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 0
Get it on Google Play
Get it on Apple App Store

 You have to first initialize the BindData variable to access any of its method's, properties etc. 
Dim BindData As New ComArtData()
BindData.ComArtGrid("procedurename", New SqlParameter() {}, _
  myGrid, e)
' In the above e stands for ComponentArt.Web.UI.CallBackEventArgs
3/15/2007 8:50:31 PM
Thats what I've been trying to do but I get a blue underline error under my BindData that says "Declaration Expected". ????

Victor A. Palma
3/15/2007 8:56:08 PM

Try this, see if it helps.

dim BindData as New CircaComArtAccess.ComArtData()
3/15/2007 9:03:53 PM
 No luck:
    Dim BindData As New CircaComArtAccess.ComArtData()

    BindData.ComArtGrid("csp_shipment_stat_qry", New SqlParameter(), GridView1)
'  --------- blue line "declaration expected" 
' its already declared! 
 Funny thing that is already declared. Anything wrong with my class? seems okay to me.

Victor A. Palma
3/15/2007 9:53:03 PM

Try this.

dim BindData as CircaComArtAccess.ComArtData
sub Page_Load(sender, e)
   If Not IsPostback Then
      BindData = New CircaComArtAccess.ComArtData()
      BindData.ComArtGrid(signature of the method)
   End If
end sub
3/15/2007 9:59:57 PM

That seems to do it. You have to declare it a global variable rather then local, hummm. The second local declaration is not needed:

    Dim BindData As CircaComArtAccess.ComArtData

    Sub Page_Load(ByVal sender, ByVal e)
        If Not IsPostBack Then
            BindData.ComArtGrid(parameters from function)
        End If
    End Sub
Awesome job! Stick out tongue 
Victor A. Palma
3/15/2007 10:07:17 PM
Well you do not have to declare it as global variable.  You can declare and initialize it in the page_load event itself.  Glad it worked for you.
3/15/2007 10:13:27 PM

Similar Artilces:

getting start with and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

Both C# ASPX pages and VB.NET ASPX in single VB.NET Web Applcation Template
Hi.. Is it possible to have both c# pages and VB pages in same Webapplication, what i chose is VB.NET Web application Template. With Thanks, Jaya.... I don't see why you couldn't, but for the sake of consistency I don't know why you would want to do this. When you choose a C# or VB.NET application template(I'm assuming you're using VS or WebMatrix), it simply creates a .aspx file that includes a page directive that specifies the page language. If you created a C# template but want to use VB.Net instead, you need to go from: <%@ Page Language="C#" .... to...

How to get HTML Source of web page opened by web browser using
hello friends,         i have opened an web browser in using the below code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim nullObject As System.Object = 0 Dim str As String = "" Dim nullObjStr As System.Object = str Windows.Forms.Cursor.Current = Cursors.WaitCursor Dim i As Int16 For i = 1 To 2 AxWebBrowser1.Navigate("", True) AxWebBrowser1.Document. Next Windows.Forms.Cursor.Current = Cursors.Default End Sub  ...

How to get the HREF value of the Anchor tag in a web page using the web browser control in
Hi Friends,               i have a webserver control in my application.i load the web browser control on a button click using the below code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click                AxWebBrowser1.Navigate("", False) End sub once the page is loaded in the browser i want the <a> HREF value in that page.For example if that page has ...

getting a VB .Net project to run in a web page
ok....we had a developer create a nice little app in vb .net. when its built its a .exe with a cfc file. It has a gui/object interface. Being a novice with this stuff. I want to get this in a .net web page and run it on my web server. Any info or refence guide to do this will be appreicated. Thank you. well.... not so easily..... is the app supposed to have some sort of output, or does it just process something on the server? if you want it to have an interface, you proablby want to take his code out, put it in a class library, or your app_code folder, change all the cfc file stuff to...

How to start coding form and Crystal repotrs)
I use Crystal Report in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use to do that ???? (please help me step by step,I try it before but not success) please help me !!! There is sample code and tutorials on my blog entry: my post is your answer, please mar...

Embed VB.NET Class Library in HTML Web Page
Hi,I'm using...Visual Studio 2008 (VB.NET).NET Framework 3.5Internet Explorer 7Windows VistaIBM WebSphere Application Server/HTTP 6.1I am trying, with not much luck, to embed a VB.NET Class Library (DLL) containing a User Control within a HTML web page. I've followed the instructions that I found here... as this is quite old I am not sure if this is still supported. If it is I can't get it working.This is my scenario; We have a Web App developed and deployed through IBM Websphere. I want this app ...

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

non .net form issue within a .net form tag
this may be a bad question... but I am adding a shopping cart to my website and it calls for the following code for the 'buy now' buttons: <form method="POST" action=><input type="hidden" name="ID" value="IDName"><input type="hidden" name="Describe" value="IDName Description"><input type="hidden" name="Price" value="100.00"><input type="hidden" name="QtyMax" value="1"><input t...

Access forms vs forms
I have to do an windows application for an access database, which currently had access forms. I am trying to convince doing it in I know I can do much better froms or front end with I am not sure how to convince my boss or client. Thanks If you want info on Windows Applications try Here's how to convince them, if they are tight about money: = Only need one license, for you the programmer, which you may already have access = need an access license for every person that uses the program (shush, don't tell them about access runtime) I...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

Where should I store my method code to be used on any page/form on my application?
I have some code (modules) that provide subroutines that I want to call from multiple pages/forms on my application. Where should I store this code? How can I "call" the subroutines from my web form? (i.e, button1_Click event ) Thanks mcr132 The correct place would in the App_Code folder in the root of your web site. You can call them by creating a new instance of your module, or directly if the subs/functions are Shared.When you have asked a question, remember to click "Mark as answered" for a reply that answered your question. This ensures the right forum me...

VB .net Web Form will not get contents of Text Box
I have created a web form with text boxes that are bound to a DataSet/DataView.  I have created button to navigate up and down the recordset.  That all works fine. I need to have the ability to edit/add text in any of the boxes and then when clicking "Save" button, it would build an UPDATE query to send to the database. When the Save button is clicked, I have coded to DIM a string var (strSQL) to use to build the SQL command.  For some reason, it will only get the text from a text box if the data was pulled the database.  If I add/edit data, then the SQL command will ha...

Converting Web Site from Vb.Net 2003 to Vb.Net 2005
I have a web site in 2003 that I what to convert to 2005. I open my web site in the visual studio 2005 by Local IIS option. I follow the steps of the visual studio conversion wizard.In the conversion report I received the following warning 'Referencepath' settings have not been converted.  Can anyone tell what I have to do to make this warning disappear? Best regards,Sérgio 'Referencepath'  is a property you can set with with VS2003 project file, sothat when ever you to do Add reference this path is serached for class libraries.  We do not  have that ...

Web resources about - Accessing a method within a class VB.NET from a Web Form page. -

Highest Percentage Of Opera Mini Users Accessing Facebook? Macau
If you were asked to guess which country had the highest percentage of users of Opera mobile Web browser Opera Mini users accessing Facebook ...

International Users Accessing Facebook Places Through US VPN Accounts
By using a virtual private network (VPN) hosted in the United States, Facebook users from around the world are accessing Facebook Places. The ...

What are some alternatives to Yodlee for accessing bank information?
Clay Loveless , Founder, Jexy. Co-founder, Mashery. Founder, Jexy. Co-founder, Mashery.

Cloud Console - Accessing files in cloud storage for iPad on the iTunes App Store
Get Cloud Console - Accessing files in cloud storage on the App Store. See screenshots and ratings, and read customer reviews.

Meryl Streep On Accessing The Characters Within - YouTube
Meryl Streep talks about the importance of an actors work representing their ability. CONNECT WITH AFI: ...

Student pleads guilty to accessing records about Frances Abbott design scholarship
The Sydney student who leaked information about a fashion school scholarship controversially awarded to the daughter of the Prime Minister has ...

Accessing a headline opinion
Accessing a headline opinion

Sharp increase in authorities accessing private data
Australian law enforcement and government agencies have sharply increased their access without warrant to vast quantities of private telephone ...

Former librarian charged with accessing student records of Frances Abbott
A former part-time librarian at a Sydney design school has been charged after she allegedly accessed student records of Prime Minister Tony Abbott's ...

Frances Abbott scholarship: Sydney woman pleads guilty to accessing Whitehouse Institute records on PM's ...
A Sydney woman who leaked the student records of Tony Abbott's daughter pleads guilty. A Sydney woman who leaked the student records of Prime ...

Resources last updated: 11/20/2015 11:19:16 PM