Click here to Skip to main content
16,010,553 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Could not load file or assembly or one of its dependencies. Pin
Eddy Vluggen21-Aug-12 3:23
professionalEddy Vluggen21-Aug-12 3:23 
GeneralRe: Could not load file or assembly or one of its dependencies. Pin
Karthik Chintala21-Aug-12 3:32
Karthik Chintala21-Aug-12 3:32 
GeneralRe: Could not load file or assembly or one of its dependencies. Pin
Dave Kreskowiak21-Aug-12 3:39
mveDave Kreskowiak21-Aug-12 3:39 
AnswerRe: Could not load file or assembly or one of its dependencies. Pin
Bernhard Hiller21-Aug-12 21:07
Bernhard Hiller21-Aug-12 21:07 
QuestionMessage Removed Pin
20-Aug-12 7:49
professionaljkirkerx20-Aug-12 7:49 
QuestionNot Understanding Delegates (User Error) Pin
Clark Kent12320-Aug-12 4:23
professionalClark Kent12320-Aug-12 4:23 
AnswerRe: Not Understanding Delegates (User Error) Pin
Eddy Vluggen20-Aug-12 13:00
professionalEddy Vluggen20-Aug-12 13:00 
GeneralRe: Not Understanding Delegates (User Error) Pin
Clark Kent12321-Aug-12 2:29
professionalClark Kent12321-Aug-12 2:29 
GeneralRe: Not Understanding Delegates (User Error) Pin
Eddy Vluggen21-Aug-12 2:56
professionalEddy Vluggen21-Aug-12 2:56 
GeneralRe: Not Understanding Delegates (User Error) Pin
Clark Kent12321-Aug-12 4:28
professionalClark Kent12321-Aug-12 4:28 
GeneralRe: Not Understanding Delegates (User Error) Pin
Eddy Vluggen21-Aug-12 4:50
professionalEddy Vluggen21-Aug-12 4:50 
QuestionMultiple checkbox in Excel file Pin
oanaa1119-Aug-12 21:20
oanaa1119-Aug-12 21:20 
AnswerRe: Multiple checkbox in Excel file Pin
Sonhospa19-Aug-12 23:37
Sonhospa19-Aug-12 23:37 
AnswerRe: Multiple checkbox in Excel file Pin
Clark Kent12320-Aug-12 3:26
professionalClark Kent12320-Aug-12 3:26 
AnswerStore Keywords in Excel doc Pin
David Mujica20-Aug-12 4:02
David Mujica20-Aug-12 4:02 
AnswerCode snipet Pin
David Mujica20-Aug-12 4:30
David Mujica20-Aug-12 4:30 
GeneralRe: Code snipet Pin
oanaa1120-Aug-12 20:10
oanaa1120-Aug-12 20:10 
QuestionHow to code the next button Pin
garyu8717-Aug-12 22:09
garyu8717-Aug-12 22:09 
AnswerRe: How to code the next button Pin
Eddy Vluggen18-Aug-12 2:05
professionalEddy Vluggen18-Aug-12 2:05 
GeneralRe: How to code the next button Pin
garyu8718-Aug-12 2:38
garyu8718-Aug-12 2:38 
Okay this is my latest working coding with navigation button but with some un-accurate display.

VB
Public Class DailyExpenses

    Dim connection As New SqlClient.SqlConnection
    Dim cmd As New SqlClient.SqlCommand
    Dim cmd1, cmd2, cmd3, cmd4, cmd5, cmd6, cmd7, cmd8, cmd9 As New SqlClient.SqlCommand
    Dim da As New SqlClient.SqlDataAdapter
    Dim ds As New DataSet
    Dim i As Integer = 0


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If connection.State <> ConnectionState.Open Then
            connection.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\PersonalExpenses.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
            connection.Open()
        End If

        Call Fill_Template()


    End Sub

#Region "Fill Data"
    Sub Fill_Template()


        'Expenses
        cmd.CommandText = "SELECT Date,Allowance,Total,Wallet FROM tblExpenses"
        cmd.Connection = connection
        da.SelectCommand = cmd
        da.Fill(ds, "tblExpenses")
        If (ds.Tables("tblExpenses").Rows.Count > 0) Then
            DateTimePicker1.Value = ds.Tables("tblExpenses").Rows(i)(0).ToString
            txtAllowance.Text = ds.Tables("tblExpenses").Rows(i)(1).ToString
            txtTotalUsage.Text = ds.Tables("tblExpenses").Rows(i)(2).ToString
            txtWalletCash.Text = ds.Tables("tblExpenses").Rows(i)(3).ToString
        End If

        'Food&Beverage
        cmd1.CommandText = "SELECT tblFoodAndBeverage.Breakfast,tblFoodAndBeverage.Lunch,tblFoodAndBeverage.Dinner,"
        cmd1.CommandText += "tblFoodAndBeverage.Supper,tblFoodAndBeverage.Snack,tblFoodAndBeverage.Beverage,"
        cmd1.CommandText += "Grocerries,Sub_Total FROM tblFoodAndBeverage,tblExpenses WHERE tblFoodAndBeverage.Food_And_BeverageID = tblExpenses.Food_And_Beverage"
        cmd1.Connection = connection
        da.SelectCommand = cmd1
        da.Fill(ds, "tblFoodAndBeverage")
        If (ds.Tables("tblFoodAndBeverage").Rows.Count > 0) Then
            txtBreakFeast.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(0).ToString
            txtLunch.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(1).ToString
            txtDinner.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(2).ToString
            txtSupper.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(3).ToString
            txtSnack.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(4).ToString
            txtBeverage.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(5).ToString
            txtGroceries.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(6).ToString
            txtSubFnB.Text = ds.Tables("tblFoodAndBeverage").Rows(i)(7).ToString
        End If



    End Sub
#End Region

#Region "Data_Fill"
 


#End Region

    Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click
        If (i <= 0) Then
            MsgBox("You are already at first position.")
        Else
            i = 0
            Call Fill_Template()
        End If

    End Sub

    Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
        If (i <= 0) Then
            MsgBox("You are already at first position.")
        Else
            i = i - 1
            Call Fill_Template()
        End If


    End Sub

    Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Dim RowCount, RowCount1 As String
        RowCount = ds.Tables("tblExpenses").Rows.Count - 1
        RowCount1 = ds.Tables("tblFoodAndBeverage").Rows.Count - 1

        If (i = RowCount) And (i = RowCount1) Then
            MsgBox("You are already at Last position.")
        Else
            i = i + 1
            Call Fill_Template()
        End If

    End Sub

    Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
        Dim RowCount, RowCount1 As String
        RowCount = ds.Tables("tblExpenses").Rows.Count - 1
        RowCount1 = ds.Tables("tblFoodAndBeverage").Rows.Count - 1

        If (i = RowCount) And (i = RowCount1) Then
            MsgBox("You are already at Last position.")
        Else
            i = ds.Tables("tblExpenses").Rows.Count
            i = ds.Tables("tblFoodAndBeverage").Rows.Count
            Call Fill_Template()
        End If
    End Sub
End Class


Problem:
1. When I click next it shows the other rows data correctly but (let's say my tblExpenses has 4 rows of data and my tblFoodAndBeverage has 2 rows of data) then when I click next after the 2nd row data the FoodAndBeverage shouldn't display any data because its null after the 2nd row but it displays duplicate data.

2. My table Expenses actually has a column(Food_And_Beverage(int)) that connects to the table FoodAndBeverage(Food_And_BeverageID). My problem is how to retrieve data based on that 2 relationship.
For example:
tblExpenses(Date(18/8/2012)) has also data on Foods but then (19/8/2012) has its own data in its table but the Foods data is null but still displays other data on that date except for food with blank data.
GeneralRe: How to code the next button Pin
Eddy Vluggen18-Aug-12 5:49
professionalEddy Vluggen18-Aug-12 5:49 
GeneralRe: How to code the next button Pin
garyu8718-Aug-12 20:01
garyu8718-Aug-12 20:01 
GeneralRe: How to code the next button Pin
Eddy Vluggen18-Aug-12 23:21
professionalEddy Vluggen18-Aug-12 23:21 
Questionvb interface wih HP impedance tester Pin
seow22716-Aug-12 21:55
seow22716-Aug-12 21:55 
AnswerRe: vb interface wih HP impedance tester Pin
Eddy Vluggen17-Aug-12 3:27
professionalEddy Vluggen17-Aug-12 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.