Records
Records
Records
Records
Records
Records Records Records Records Records Records Records Records
Records Records
Records
Go Back  Xtreme Visual Basic Talk > > > Records


Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2012, 10:11 AM
vbprotobe vbprotobe is offline
Newcomer
 
Join Date: Feb 2012
Posts: 1
Exclamation Records


Hi all,

I am fairly new to VB, do have some vba background though.

I am basically trying to create some records using Structures as you can see below, however the value of Index doesnt seem to be incrementing as I am assigning it to txtCustomerId.text each time form loads, however the value of the text box remains at 1000 all the time, any help much appreciated.

Code:
 
Public Class Form1

    Dim NumberOfCustomers As Integer
    Dim Index As Integer

    Structure CustomerType
        Dim CustomerId As Integer
        Dim Firstname As String
        Dim Lastname As String
        Dim Address As String
        Dim DOB As Date
        Dim StartDate As Date
    End Structure
    Public Customers(999) As CustomerType
    Public NumberOfTransactions As Integer
    Structure TransactionType
        Dim TransactionId As Integer
        Dim Value As Decimal
        Dim CollectedPoints As String
        Dim PointsRedeemed As String
        Dim TransactionDate As Date
        Dim BusinessId As Integer
        Dim CardNo As String
    End Structure
    Public Transactions(999) As TransactionType
    Public NumberOfCards As Integer
    Structure CardType
        Dim CardId As String
        Dim StartDate As Date
        Dim IssuedBy As String
        Dim CustomerId As String
    End Structure
    Public Cards(999) As CardType
------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Customers(Index).CustomerId = txtCustomerId.Text
        Transactions(Index).Value = txtTransValue.Text
        Transactions(Index).CollectedPoints = lblNewPoints.Text
        Cards(Index).CardId = Form2.txtCardId.Text
        Cards(Index).StartDate = Today
        Cards(Index).CustomerId = Customers(Index).CustomerId
        NumberOfCustomers = NumberOfCustomers + 1
        NumberOfTransactions = NumberOfTransactions + 1
        NumberOfCards = NumberOfCards + 1
        Index = Index + 1
        MsgBox("You have successfully saved")
        Dim SecondForm As New Form2()
        SecondForm.Show()
        Me.Close()
        Form2.txtCardId.Text = ""
    End Sub
---------------------------------
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Customers(Index).CustomerId = txtCustomerId.Text
        Transactions(Index).Value = txtTransValue.Text
        Transactions(Index).CollectedPoints = lblNewPoints.Text
        Cards(Index).CardId = Form2.txtCardId.Text
        Cards(Index).StartDate = Today
        Cards(Index).CustomerId = Customers(Index).CustomerId
        NumberOfCustomers = NumberOfCustomers + 1
        NumberOfTransactions = NumberOfTransactions + 1
        NumberOfCards = NumberOfCards + 1
        Index = Index + 1
        MsgBox("You have successfully saved")
        Dim SecondForm As New Form2()
        SecondForm.Show()
        Me.Close()
        Form2.txtCardId.Text = ""
    End Sub
Reply With Quote
  #2  
Old 02-27-2012, 04:12 AM
DrPunk's Avatar
DrPunkRecords DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Textboxes by default aren't databound. Assigning the textbox to display a value will not have the textbox change when the assigned value changes. You have to tell the textbox to display the new value.
__________________
There are no computers in heaven!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Records
Records
Records Records
Records
Records
Records Records Records Records Records Records Records
Records
Records
 
Records
Records
 
-->