Thank you very much for your kind response.
It saved me a lot of time. and Calling proceedure well worked just altering with x.

Dim x As New ClassfrmLoad
        ClassfrmLoad.formLoad(Me.btnAdd, Me.btnEdit, Me.btnSave, Me.btnCancel, Me.btnClose, Me.btnUpdate, Me.btnFind)

vijaycare Newbie Poster

I am herewith develop an application but I have created a class which calls button events(i.e. enable or visible).

I am actually created the button events class(classfrmLoad) for the way which buttons should be enabled and visible when each & every form loading.

There are 6 buttons in the forms (frm1, frm2 etc.,) like btnAdd, btnEdit, btnCancel etc., i don't want to display the buttons(visible/enable) while loading the form.

Public Class ClassfrmLoad

Dim btnAdd As New Button
Dim btnEdit As New Button

Private Sub FormLoad()

    Me.btnAdd.Visible = True
    Me.btnAdd.Enabled = True

    Me.btnEdit.Visible = True
    Me.btnEdit.Enabled = False

End Sub

End Class

Here is the question: How can i call this class(classfrmLoad) events to alter (enable/visible) the buttons positioned in the forms(frm1, frm2, etc.,) and how to get the buttons events in those forms?

vijaycare Newbie Poster


I am using windows form. One of the form containing a combobox which populates data using datatable method. If the user found there is no particular data then they can add using an another form thru a button click to open and save the data. The saved data in the 2nd form does not updated in the first one. I am using unbound combobox. Any help would be appreciated.


Hi Aslam,

Thanks for your reply.
I know it requires 3 datatables and I am already written query for the 3 datatables.
What my issue is, How to combine these 3 datatables based on ID column and add and subtract the Qty column.


Thanks Jim,

from the above example how can i use this result in a datagridview?

vijaycare Newbie Poster

Hi All,

I have 2 data table in my application and want to create a new table from those 2 tables.

  Dim sql As String = "Select ID, DESC, QTY from Purchases Where PDate >= @StartDt and PDate <=@EndDt order by ID"
    Dim da As New OleDb.OleDbDataAdapter(Sql, Con.conn)
    da.selectCommand.Parameters.AddwithValue ("@StartDt", me.dtpStart.value.Date)
    da.selectCommand.Parameters.AddwithValue ("@EndDt", me.dtpEnd.value.Date)
    Dim dt As New DataTable
    da.fill (dt)

The table1 contains data like

The tabl2 contains data like

1 ASD 2000
2 BNS 1500
3 DSC 200
4 QSR 300
5 RSJ 4500
6 JVS 1800
7 LKS 1450

And I want to create a table from those 2 tables like:

1 ASD 2500
2 BNS 1500
3 DSC 900
4 QSR 940
5 RSJ 4500
6 JVS 2900
7 LKS 1950

how can i achieve this. Any suggestion would be appreciated. Thanks

vijaycare Newbie Poster

Hi All,

I am having a stock report in my application. It has 4 Datagridview each one for OpeningStock, Purchase, Sales and ClosingStock. I am using vs2005 and access 2003 database. The report is based on from and to date basis. (i.e: if the user selects 2 dates, The opeining stock should be inclusive of opening stock+purchases-Sales made upto the startdate) likewise the purchase, sales and closing stock details.

I have 3 datatables one for the opening stock (Which is keyed in the beginning of the application), the another one contains purchasedetails upto the startdate and another one for salesdetails upto startdate.

What i want to show is datagrid1 for showing the opening balance
(i.e:InitialStock + Purchase - Sales) up to startdate,
datagrid2 is for showing the purchase (i.e: Purchases made from and to between dates)
datagrid3 is for showing the Sales (i.e: Sales made from and to between dates)
and datagrid4 is for showing the closingstock (i.e: InitialStock + Purchases - sales) upto the enddate.

Thanks in advance.
Any suggestion would be appreciated.


Thanks john.


hi john,
I am very sorry for my late answer.
Your view is absolutely correct.
When the application startsup the user has signed in and after that they have selected the database (i.e: 10462.mdb, 61973.mdb etc). After that I have a connected thru a connection class using the current database. Its working fine. But I don't know how to use the same method in crystal reports.

vijaycare Newbie Poster

Hi All,

I have a Delivery report.
In the report printing thru PrintReport function in I want to add a word at runtime (i.e: Original, Duplicate, Triplicate, etc.)

I am using the following code to print the document.


How can i achieve this.
Please help me. Thanks in advance.

vijaycare Newbie Poster

I have a delivery challan and it should be printed 3copies which has setting in crystal report itself.
What i want is it should be printed on each copy as "Original", "Duplicate", "Triplicate" etc. Since I have written a single line of code to print ther crystal report by click a button in and using access db.

Any suggesstion would be appreciated to get out this problem. Thanks.


vijaycare Newbie Poster

Hi All,

I would like to thank this community for the enormous help to develop my skills. Thanks.

I have 2 databases and a single report form and a crystal reportviewer.
The User can select the database which he want to work
(Each of them belongs to different warehouse)
So he can select and make dc, invoice, and associated work for the particular database.
I have a dataclass it difines which database selected and which data should be retrieved
using a login screen which contains a database selection combo. All goes well.

I am also created a report format in crystal report. and it also have parameters.
If it is a single database report i can easily connect the data thru typed dataset.

But I have 2 databases, how can i get the report source for the report
My problem is how to retrieve the data for the particular database to that crystal reports.

Please let me give some idea about getting the particular database data for the report.
Thanks in advance.....


After trying a lot i have changed the code slightly and it shows that "The report has no tables. Please help......

` Dim ReportPath As String = "D:\Explosive Soft\Explosoft\Explosoft"

    'Declaring report document
    Dim rpt1 As New ReportDocument
    Dim rpt2 As New ReportDocument

    rpt1.Load(ReportPath & "\DeliveryChallan.rpt")
    rpt2.Load(ReportPath & "\MatForm.rpt")


        'Creating report
        'and get the godown details as a dataset
        Dim conection As New ClassConnectGodown
        If conection.Conn.State = ConnectionState.Closed Then conection.Conn.Open()

        Dim sql As String = "Select LicenseNo, ValidTill, Village, Taluk, District from Godown Where GodSName = @GID"
        Dim da As New OleDb.OleDbDataAdapter(sql, conection.Conn)
        da.SelectCommand.Parameters.AddWithValue("@GID", frmMain.ToolStripStatuslblGodown.Text)
        Dim ds As New DataSet
        Dim dv As New DataView
        Dim dt As New DataTable
        da.Fill(ds, "Godown")
        dv = New DataView(ds.Tables(0))
        dt = dv.ToTable

        conection.Conn = Nothing


        Dim ID As Integer
        ID = frmDelivery.txtID.Text

        Dim con As New ClassConnect
        If con.Conn.State = ConnectionState.Closed Then con.Conn.Open()

        Dim sql1 As String = "SELECT Delivery.DelID, Delivery.DelDate, OPDDetails.BatchNo, OPDDetails.BatchDate," & _
            " OPDDetails.Packs, OPDDetails.LPacks, OPDDetails.NetQty, Products.ProdName, Brands.BrClass, Brands.BrDivision," & _
            " Customers.CustName, Customers.Village, Customers.Taluk, Customers.RCNo, Customers.SurveyNo, Trucks.TruckNo," & _
            " Trucks.License, Trucks.ValidTill FROM Trucks INNER JOIN (Customers INNER JOIN (Products INNER JOIN" & _
            " (Brands INNER JOIN (Delivery INNER JOIN OPDDetails ON Delivery.DelID = OPDDetails.DelID) ON" & _
            " Brands.BrID = OPDDetails.BrandID) ON Products.ProdID = Brands.ProdID) ON Customers.CustID = Delivery.CustID)" & _
            " ON Trucks.TruckID = Delivery.TruckID WHERE Delivery.DelID = @DID AND OPDDetails.NetQty >0"
        Dim da1 As New OleDb.OleDbDataAdapter(sql1, con.Conn)
        da1.SelectCommand.Parameters.AddWithValue("@DID", ID)
        Dim ds1 As New DataSet
        'Dim dv1 As New DataView
        'Dim dt1 ...

vijaycare Newbie Poster

Hi All,

I am working for a database solution using vs 2005, and it is in final stage for reporting.
I have 3 access databases. One is for selecting godown. And the remaining is godownwise databases.
The godownwise databases having same structure (Tables and relationship but the data may be differ)

Actually the user work thru selection on the godown (i.e: first database named Comp_God.mdb)
After the users selection my application goes thru according to the godown number (i.e: Database 50000, 60000 etc) according to the selection of the first database of comp_god.

What my problem is actually I know how to work with a single database for reporting
But my present situation is to select the report data based on the users current godown.

Please guide me how to create it. The following code is working upto saving the data to the tables.
how to get the dataset data into crystal report?

Any help would be appreciated.

Dim con As New ClassConnect
        If con.Conn.State = ConnectionState.Closed Then con.Conn.Open()

        Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand
        Dim cmd1 As OleDb.OleDbCommand = New OleDb.OleDbCommand

        cmd.Connection = con.Conn
        cmd1.Connection = con.Conn

        cmd.CommandText = "Insert into Delivery" & _
       "(DelID, DelDate, CustID, MatID, TruckID, Remarks, InvAmt, LoginUser, LUpdate, MUser, MDate)" & _
       "Values (@DelID, @DelDate, @CID, @MID, @TID, @Rem, @InvAmt, @LUser, @LUpdate, @MUser, @MDate)"

        cmd1.CommandText = "Insert into OPDDetails" & _
        "(OPDDate, DelID, SID, BrandID, BatchNo, BatchDate, UnitsPerPack, Quantity, NetQty, Rate, Amount, LoginUser, LUpdate, MUser, MDate, Packs, LPacks)" & _
        "Values (@OPDate, @DelID, ...

vijaycare Newbie Poster

Dear all,

I have developed a small application to my users in my company. I have almost finished that. I have designed the crystal report for each delivery challan they have entered and saved the application will ask about printing the current record. But the user wants to take the delivery challan printouts in a bulk way. (i.e: they want to take after saving the record) Is it possible to take the bulk printouts when they input the delivery challan no. 1 to 15 like that. If it is possible please guide me how can i do that? More important i am using vb2005 with access database.

vijaycare Newbie Poster

I am using vs2005 with access 2003. In my windows application there is one tabcontrol which contains 2 tabpages with 2 crystal report viewer for each one. I have loaded data in form load event. It works great. Unfortunately the 2nd tabpage is not displaying the crystal report toolbar. The 1st page only shows the crystal report toolbar.
Is there a way to solve this problem or can i print all the 2 tabpage report in a single click.

Suggestions would be highly appreciated. Thanks in advance.


Thank you so much for your kind help sir............

vijaycare Newbie Poster

Hi All,

I am using vs2005 with access database.
Developing a new application. I am the new one to the application development.
This is what my situation which takes my time towards searching a reference
but no where it is found:

There is 2 tables named tblbill(contains VendorID & TruckID) and
tblvendor(contains VendorID & VendorName)
Where my user wants to display the vendorname against what he selected the TruckID

I know how to catch the VendorID in selection of the TruckID
But doesn't know how to retrieve the Vendorname based on the vendorID.
Please show me a sample to solve this problem...

Kindly help me,
Thanks in advance....


Thanks I will try and let you know.


I know this syntax will work with query in database. But in the case of Crystal report how it will be used? I need breif explanation.
Thanks for trying to reply me.

vijaycare Newbie Poster

Hi, I am using vb2005 with access database and I have a crystal report which I want to preview and print only the last saved record. How can I do it?
Can any one help me with sample code


I think it is working. but it will takes the database month as date.
Can U tell me where I made a mistake?


Yes Its databound control which I have used. Kindly let me know how can i filter the date value in my data with datetimepickers.

Thanks in advance

vijaycare Newbie Poster

Hi, I am a new one to vb 2005. I dont know how to filter the datagridview with the 2 datetimepicker control one for start date and another one for end date. I want to search the dates based on the datevalue of the data in one coloumn.

Any one can help me?
Thanks in advance.


Thanks for the quick reply.
I am a new bee and i dont know how to implement the dataadaptor to fill the data set. can u pl help me with an example..


vijaycare Newbie Poster

Hi, I am having the same problem [I]<<mod edit: [URL=""]as this[/URL] >>[/I] when i update my record in Access Database. It is successfully updated the record in the database. but the dataset in my project is still not updated. I am using vb 2005 to develop the application.

Any one can help me to this problem?
Advance Thanks.