please help

hello..
im using an array of textboxes [blue](which there are four textboxes in the array)[/blue], created on the form. each of these textboxes inputs are ment to populate a msflexgrid.

1. im trying to use the array so i can populate a record without having to use
[size=1]
Private Sub Command1_Click()
Dim Name As String, dr As Integer, tre As Integer, srt As Integer
Name = Text1(0).Text
MSFlexGrid1.TextMatrix(1, 1) = Name
dr = Text1(1).Text
MSFlexGrid1.TextMatrix(1, 2) = dr
tre = Text1(2).Text
MSFlexGrid1.TextMatrix(1, 3) = tre
srt = Text1(3).Text
MSFlexGrid1.TextMatrix(1, 4) = srt
[/size]
this code works but i would like to move to the next record and then pupulate that.

2. how can i use an updown control button to move up and down the records so i can input a new record in a different row?

to explain... visualise a table
the inputs from the array of textboxes will represent a record on the table or msflexgrid [blue](the entire row)[/blue]

3. this can be down without an array of textboxes but im trying to work the code out to enter a record without having to state where each of the variables are going. (textmatrix(0, 1) etc) instead just the array. this may help me later on.

i hope im clear if im not anywhere im happy to explain.
thanks.

Comments

  • my idea is add a new row, then swap the records one by one. but i dun know will there be any better methods.


  • : hello..
    : im using an array of textboxes [blue](which there are four textboxes in the array)[/blue], created on the form. each of these textboxes inputs are ment to populate a msflexgrid.
    :
    : 1. im trying to use the array so i can populate a record without having to use
    : [size=1]
    : Private Sub Command1_Click()
    : Dim Name As String, dr As Integer, tre As Integer, srt As Integer
    : Name = Text1(0).Text
    : MSFlexGrid1.TextMatrix(1, 1) = Name
    : dr = Text1(1).Text
    : MSFlexGrid1.TextMatrix(1, 2) = dr
    : tre = Text1(2).Text
    : MSFlexGrid1.TextMatrix(1, 3) = tre
    : srt = Text1(3).Text
    : MSFlexGrid1.TextMatrix(1, 4) = srt
    : [/size]
    : this code works but i would like to move to the next record and then pupulate that.
    :
    : 2. how can i use an updown control button to move up and down the records so i can input a new record in a different row?
    :
    : to explain... visualise a table
    : the inputs from the array of textboxes will represent a record on the table or msflexgrid [blue](the entire row)[/blue]
    :
    : 3. this can be down without an array of textboxes but im trying to work the code out to enter a record without having to state where each of the variables are going. (textmatrix(0, 1) etc) instead just the array. this may help me later on.
    :
    : i hope im clear if im not anywhere im happy to explain.
    : thanks.
    :


    Put this up in the declaration section of your form

    [b]Private CurrentRow As Long[/b]

    In the Form Load Event:

    [b]CurrentRow = InitialRow[/b]

    Then use the DownClick and UpClick Events as follows:

    [b]Private Sub UpDown1_DownClick()
    If (CurrentRow > MSFlexGrid1.FixedRows + 1)
    CurrentRow = CurrentRow - 1
    With MSFLexGrid1
    Dim a As Long
    For a = 0 To 3 'Change 3 to the number of the last col
    Text1(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub

    Private Sub UpDown1_UpClick()
    If (CurrentRow < MSFlexGrid1.FixedRows - 1
    CurrentRow = CurrentRow + 1
    With MSFLexGrid1
    Dim a As Long
    For a = 0 To 3 'Change 3 to the number of the last col
    Text1(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub[/b]

    Then in the click event of your command button do the following

    [b]Dim a As Long
    For a = 0 To 3
    MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    Next a[/b]

    This code has just been written on the spot, so it might contain a few bugs. If you have any trouble debugging it let me know.











  • : : hello..
    : : im using an array of textboxes [blue](which there are four textboxes in the array)[/blue], created on the form. each of these textboxes inputs are ment to populate a msflexgrid.
    : :
    : : 1. im trying to use the array so i can populate a record without having to use
    : : [size=1]
    : : Private Sub Command1_Click()
    : : Dim Name As String, dr As Integer, tre As Integer, srt As Integer
    : : Name = Text1(0).Text
    : : MSFlexGrid1.TextMatrix(1, 1) = Name
    : : dr = Text1(1).Text
    : : MSFlexGrid1.TextMatrix(1, 2) = dr
    : : tre = Text1(2).Text
    : : MSFlexGrid1.TextMatrix(1, 3) = tre
    : : srt = Text1(3).Text
    : : MSFlexGrid1.TextMatrix(1, 4) = srt
    : : [/size]
    : : this code works but i would like to move to the next record and then pupulate that.
    : :
    : : 2. how can i use an updown control button to move up and down the records so i can input a new record in a different row?
    : :
    : : to explain... visualise a table
    : : the inputs from the array of textboxes will represent a record on the table or msflexgrid [blue](the entire row)[/blue]
    : :
    : : 3. this can be down without an array of textboxes but im trying to work the code out to enter a record without having to state where each of the variables are going. (textmatrix(0, 1) etc) instead just the array. this may help me later on.
    : :
    : : i hope im clear if im not anywhere im happy to explain.
    : : thanks.
    : :
    :
    :
    : Put this up in the declaration section of your form
    :
    : [b]Private CurrentRow As Long[/b]
    :
    : In the Form Load Event:
    :
    : [b]CurrentRow = InitialRow[/b]
    :
    : Then use the DownClick and UpClick Events as follows:
    :
    : [b]Private Sub UpDown1_DownClick()
    : If (CurrentRow > MSFlexGrid1.FixedRows + 1)
    : CurrentRow = CurrentRow - 1
    : With MSFLexGrid1
    : Dim a As Long
    : For a = 0 To 3 'Change 3 to the number of the last col
    : Text1(a).Text = .TextMatrix(CurrentRow, a)
    : Next a
    : End With
    : End If
    : End Sub
    :
    : Private Sub UpDown1_UpClick()
    : If (CurrentRow < MSFlexGrid1.FixedRows - 1
    : CurrentRow = CurrentRow + 1
    : With MSFLexGrid1
    : Dim a As Long
    : For a = 0 To 3 'Change 3 to the number of the last col
    : Text1(a).Text = .TextMatrix(CurrentRow, a)
    : Next a
    : End With
    : End If
    : End Sub[/b]
    :
    : Then in the click event of your command button do the following
    :
    : [b]Dim a As Long
    : For a = 0 To 3
    : MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    : Next a[/b]
    :
    : This code has just been written on the spot, so it might contain a few bugs. If you have any trouble debugging it let me know.
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :

    thanks for the replys. the only problem with the code above is the click event

    [b]Private Sub Command1_Click()
    Dim a As Long
    For a = 0 To 3
    MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    Next a[/b]

    during runtime error message comes up with a "wrong number of arguments or invalid property assignments" which on debug it highlights the "Text1"

    im not shaw how to fix it?

  • : : : hello..
    : : : im using an array of textboxes [blue](which there are four textboxes in the array)[/blue], created on the form. each of these textboxes inputs are ment to populate a msflexgrid.
    : : :
    : : : 1. im trying to use the array so i can populate a record without having to use
    : : : [size=1]
    : : : Private Sub Command1_Click()
    : : : Dim Name As String, dr As Integer, tre As Integer, srt As Integer
    : : : Name = Text1(0).Text
    : : : MSFlexGrid1.TextMatrix(1, 1) = Name
    : : : dr = Text1(1).Text
    : : : MSFlexGrid1.TextMatrix(1, 2) = dr
    : : : tre = Text1(2).Text
    : : : MSFlexGrid1.TextMatrix(1, 3) = tre
    : : : srt = Text1(3).Text
    : : : MSFlexGrid1.TextMatrix(1, 4) = srt
    : : : [/size]
    : : : this code works but i would like to move to the next record and then pupulate that.
    : : :
    : : : 2. how can i use an updown control button to move up and down the records so i can input a new record in a different row?
    : : :
    : : : to explain... visualise a table
    : : : the inputs from the array of textboxes will represent a record on the table or msflexgrid [blue](the entire row)[/blue]
    : : :
    : : : 3. this can be down without an array of textboxes but im trying to work the code out to enter a record without having to state where each of the variables are going. (textmatrix(0, 1) etc) instead just the array. this may help me later on.
    : : :
    : : : i hope im clear if im not anywhere im happy to explain.
    : : : thanks.
    : : :
    : :
    : :
    : : Put this up in the declaration section of your form
    : :
    : : [b]Private CurrentRow As Long[/b]
    : :
    : : In the Form Load Event:
    : :
    : : [b]CurrentRow = InitialRow[/b]
    : :
    : : Then use the DownClick and UpClick Events as follows:
    : :
    : : [b]Private Sub UpDown1_DownClick()
    : : If (CurrentRow > MSFlexGrid1.FixedRows + 1)
    : : CurrentRow = CurrentRow - 1
    : : With MSFLexGrid1
    : : Dim a As Long
    : : For a = 0 To 3 'Change 3 to the number of the last col
    : : Text1(a).Text = .TextMatrix(CurrentRow, a)
    : : Next a
    : : End With
    : : End If
    : : End Sub
    : :
    : : Private Sub UpDown1_UpClick()
    : : If (CurrentRow < MSFlexGrid1.FixedRows - 1
    : : CurrentRow = CurrentRow + 1
    : : With MSFLexGrid1
    : : Dim a As Long
    : : For a = 0 To 3 'Change 3 to the number of the last col
    : : Text1(a).Text = .TextMatrix(CurrentRow, a)
    : : Next a
    : : End With
    : : End If
    : : End Sub[/b]
    : :
    : : Then in the click event of your command button do the following
    : :
    : : [b]Dim a As Long
    : : For a = 0 To 3
    : : MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    : : Next a[/b]
    : :
    : : This code has just been written on the spot, so it might contain a few bugs. If you have any trouble debugging it let me know.
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    :
    : thanks for the replys. the only problem with the code above is the click event
    :
    : [b]Private Sub Command1_Click()
    : Dim a As Long
    : For a = 0 To 3
    : MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    : Next a[/b]
    :
    : during runtime error message comes up with a "wrong number of arguments or invalid property assignments" which on debug it highlights the "Text1"
    :
    : im not shaw how to fix it?
    :

    Its working fine on my computer. The only thing I can think of is that maybe your textbox isn't a part of a control array. Check that all the text boxes involved all have its name property set to "Text1", and check that you have one text box with with an index value set to 0, another with an index set to 1, and the index value of the other two set to 2 and 3.



  • [size=1]: : : : hello..
    : : : : im using an array of textboxes [blue](which there are four textboxes in the array)[/blue], created on the form. each of these textboxes inputs are ment to populate a msflexgrid.
    : : : :
    : : : : 1. im trying to use the array so i can populate a record without having to use
    : : : : [size=1]
    : : : : Private Sub Command1_Click()
    : : : : Dim Name As String, dr As Integer, tre As Integer, srt As Integer
    : : : : Name = Text1(0).Text
    : : : : MSFlexGrid1.TextMatrix(1, 1) = Name
    : : : : dr = Text1(1).Text
    : : : : MSFlexGrid1.TextMatrix(1, 2) = dr
    : : : : tre = Text1(2).Text
    : : : : MSFlexGrid1.TextMatrix(1, 3) = tre
    : : : : srt = Text1(3).Text
    : : : : MSFlexGrid1.TextMatrix(1, 4) = srt
    : : : : [/size]
    : : : : this code works but i would like to move to the next record and then pupulate that.
    : : : :
    : : : : 2. how can i use an updown control button to move up and down the records so i can input a new record in a different row?
    : : : :
    : : : : to explain... visualise a table
    : : : : the inputs from the array of textboxes will represent a record on the table or msflexgrid [blue](the entire row)[/blue]
    : : : :
    : : : : 3. this can be down without an array of textboxes but im trying to work the code out to enter a record without having to state where each of the variables are going. (textmatrix(0, 1) etc) instead just the array. this may help me later on.
    : : : :
    : : : : i hope im clear if im not anywhere im happy to explain.
    : : : : thanks.
    : : : :
    : : :
    : : :
    : : : Put this up in the declaration section of your form
    : : :
    : : : [b]Private CurrentRow As Long[/b]
    : : :
    : : : In the Form Load Event:
    : : :
    : : : [b]CurrentRow = InitialRow[/b]
    : : :
    : : : Then use the DownClick and UpClick Events as follows:
    : : :
    : : : [b]Private Sub UpDown1_DownClick()
    : : : If (CurrentRow > MSFlexGrid1.FixedRows + 1)
    : : : CurrentRow = CurrentRow - 1
    : : : With MSFLexGrid1
    : : : Dim a As Long
    : : : For a = 0 To 3 'Change 3 to the number of the last col
    : : : Text1(a).Text = .TextMatrix(CurrentRow, a)
    : : : Next a
    : : : End With
    : : : End If
    : : : End Sub
    : : :
    : : : Private Sub UpDown1_UpClick()
    : : : If (CurrentRow < MSFlexGrid1.FixedRows - 1
    : : : CurrentRow = CurrentRow + 1
    : : : With MSFLexGrid1
    : : : Dim a As Long
    : : : For a = 0 To 3 'Change 3 to the number of the last col
    : : : Text1(a).Text = .TextMatrix(CurrentRow, a)
    : : : Next a
    : : : End With
    : : : End If
    : : : End Sub[/b]
    : : :
    : : : Then in the click event of your command button do the following
    : : :
    : : : [b]Dim a As Long
    : : : For a = 0 To 3
    : : : MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    : : : Next a[/b]
    : : :
    : : : This code has just been written on the spot, so it might contain a few bugs. If you have any trouble debugging it let me know.
    : : :
    : : :
    : : :

    : : :
    : :
    : : thanks for the replys. the only problem with the code above is the click event
    : :
    : : [b]Private Sub Command1_Click()
    : : Dim a As Long
    : : For a = 0 To 3
    : : MSFlexGrid1.TextMatrix(CurrentRow, a) = Text1(a).Text
    : : Next a[/b]
    : :
    : : during runtime error message comes up with a "wrong number of arguments or invalid property assignments" which on debug it highlights the "Text1"
    : :
    : : im not shaw how to fix it?
    : :
    :
    : Its working fine on my computer. The only thing I can think of is that maybe your textbox isn't a part of a control array. Check that all the text boxes involved all have its name property set to "Text1", and check that you have one text box with with an index value set to 0, another with an index set to 1, and the index value of the other two set to 2 and 3.
    :
    :
    :[/size]


    i got the program running all the control array names are all the same and the values. the problem know is that on the MSflexgrid the new persons entry doesnt move to the next record below. ive tryed things cant seem to work it out tho.

    heres the code for you to examin (the textbox contol array has been renamed to "fred")

    [size=1]Private CurrentRow As Long
    Private Sub Command1_Click()
    Dim Name As String, Ma As Integer, Maa As Integer, Maaa As Integer
    Dim a As Long
    For a = 0 To 3
    MSFlexGrid1.TextMatrix(CurrentRow, a) = fred(a).Text
    Next a
    End Sub

    Private Sub Form_Load()
    CurrentRow = InitialRow
    MSFlexGrid1.TextMatrix(0, 1) = "Name"
    MSFlexGrid1.TextMatrix(0, 2) = "Mark 1"
    MSFlexGrid1.TextMatrix(0, 3) = "Mark 2"
    MSFlexGrid1.TextMatrix(0, 4) = "Mark 3"
    MSFlexGrid1.TextMatrix(0, 5) = "Average"
    MSFlexGrid1.TextMatrix(1, 0) = "1"
    MSFlexGrid1.TextMatrix(2, 0) = "2"
    MSFlexGrid1.TextMatrix(3, 0) = "3"
    MSFlexGrid1.TextMatrix(4, 0) = "4"
    MSFlexGrid1.TextMatrix(5, 0) = "5"
    MSFlexGrid1.TextMatrix(6, 0) = "6"
    MSFlexGrid1.TextMatrix(7, 0) = "7"
    MSFlexGrid1.TextMatrix(8, 0) = "8"
    MSFlexGrid1.TextMatrix(9, 0) = "9"
    MSFlexGrid1.TextMatrix(10, 0) = "10"

    End Sub

    Private Sub upd_Change()
    Label6.Caption = Format(upd.Value, "0")
    End Sub

    Private Sub UpDown1_DownClick()
    If CurrentRow > MSFlexGrid1.FixedRows + 1 Then
    CurrentRow = CurrentRow - 1
    With MSFlexGrid1
    Dim a As Long
    For a = 0 To 3 'Change 3 to the number of the last col
    fred(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub

    Private Sub UpDown1_UpClick()
    If CurrentRow < MSFlexGrid1.FixedRows - 1 Then
    CurrentRow = CurrentRow + 1
    With MSFlexGrid1
    Dim a As Long
    For a = 0 To 3 'Change 3 to the number of the last col
    fred(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub
    [/size]


  • : i got the program running all the control array names are all the same and the values. the problem know is that on the MSflexgrid the new persons entry doesnt move to the next record below. ive tryed things cant seem to work it out tho.
    :
    : heres the code for you to examin (the textbox contol array has been renamed to "fred")


    I'm not sure if I'm following. Are you trying to get the added item to go after the currently selected record in the MSFlexGrid, or are you having trouble getting the updown control to move to the next record?

    Anyway I've spotted a couple of things which you may need to change. Every line in which I have made a change is in blue. Every Line in which I believe you need to change yourself is in purple with a comment next to it.

    [code]Private CurrentRow As Long
    Private Sub Command1_Click()
    [purple]Dim Name As String, Ma As Integer, Maa As Integer, Maaa As Integer 'I don't think you need this line, as none of the variables are used in the sub[/purple]
    Dim a As Long
    [blue]For a = 1 To 5 'I think you need 5 text boxes in the control array with index values from 1 To 5[/blue]
    MSFlexGrid1.TextMatrix(CurrentRow, a) = fred(a).Text
    Next a
    End Sub

    Private Sub Form_Load()
    [purple]CurrentRow = InitialRow 'InitialRow needs to be replaced with the row number which contains the data which is loaded into the textboxes when the form first loads. An example is found on the line below:
    'CurrentRow = 1
    [/purple]
    MSFlexGrid1.TextMatrix(0, 1) = "Name"
    MSFlexGrid1.TextMatrix(0, 2) = "Mark 1"
    MSFlexGrid1.TextMatrix(0, 3) = "Mark 2"
    MSFlexGrid1.TextMatrix(0, 4) = "Mark 3"
    MSFlexGrid1.TextMatrix(0, 5) = "Average"
    MSFlexGrid1.TextMatrix(1, 0) = "1"
    MSFlexGrid1.TextMatrix(2, 0) = "2"
    MSFlexGrid1.TextMatrix(3, 0) = "3"
    MSFlexGrid1.TextMatrix(4, 0) = "4"
    MSFlexGrid1.TextMatrix(5, 0) = "5"
    MSFlexGrid1.TextMatrix(6, 0) = "6"
    MSFlexGrid1.TextMatrix(7, 0) = "7"
    MSFlexGrid1.TextMatrix(8, 0) = "8"
    MSFlexGrid1.TextMatrix(9, 0) = "9"
    MSFlexGrid1.TextMatrix(10, 0) = "10"

    End Sub

    Private Sub upd_Change()
    Label6.Caption = Format(upd.Value, "0")
    End Sub

    Private Sub UpDown1_DownClick()
    If CurrentRow > MSFlexGrid1.FixedRows + 1 Then
    CurrentRow = CurrentRow - 1
    With MSFlexGrid1
    Dim a As Long
    [blue]For a = 1 To 5 'Needs to be 1 to 5 so it sets the value for all 5 text boxes[/blue]
    fred(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub

    Private Sub UpDown1_UpClick()
    If CurrentRow < MSFlexGrid1.FixedRows - 1 Then
    CurrentRow = CurrentRow + 1
    With MSFlexGrid1
    Dim a As Long
    [blue]For a = 0 To 3 'Needs to be 1 to 5 so it sets the value for all 5 text boxes [/blue]
    fred(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub[/code}

    I don't know if that solves your problem. If it didn't could you post back with more info.






  • : : i got the program running all the control array names are all the same and the values. the problem know is that on the MSflexgrid the new persons entry doesnt move to the next record below. ive tryed things cant seem to work it out tho.
    : :
    : : heres the code for you to examin (the textbox contol array has been renamed to "fred")
    :
    :
    : I'm not sure if I'm following. Are you trying to get the added item to go after the currently selected record in the MSFlexGrid, or are you having trouble getting the updown control to move to the next record?
    :
    : Anyway I've spotted a couple of things which you may need to change. Every line in which I have made a change is in blue. Every Line in which I believe you need to change yourself is in purple with a comment next to it.
    :
    : [code]Private CurrentRow As Long
    : Private Sub Command1_Click()
    : [purple]Dim Name As String, Ma As Integer, Maa As Integer, Maaa As Integer 'I don't think you need this line, as none of the variables are used in the sub[/purple]
    : Dim a As Long
    : [blue]For a = 1 To 5 'I think you need 5 text boxes in the control array with index values from 1 To 5[/blue]
    : MSFlexGrid1.TextMatrix(CurrentRow, a) = fred(a).Text
    : Next a
    : End Sub
    :
    : Private Sub Form_Load()
    : [purple]CurrentRow = InitialRow 'InitialRow needs to be replaced with the row number which contains the data which is loaded into the textboxes when the form first loads. An example is found on the line below:
    : 'CurrentRow = 1
    : [/purple]
    : MSFlexGrid1.TextMatrix(0, 1) = "Name"
    : MSFlexGrid1.TextMatrix(0, 2) = "Mark 1"
    : MSFlexGrid1.TextMatrix(0, 3) = "Mark 2"
    : MSFlexGrid1.TextMatrix(0, 4) = "Mark 3"
    : MSFlexGrid1.TextMatrix(0, 5) = "Average"
    : MSFlexGrid1.TextMatrix(1, 0) = "1"
    : MSFlexGrid1.TextMatrix(2, 0) = "2"
    : MSFlexGrid1.TextMatrix(3, 0) = "3"
    : MSFlexGrid1.TextMatrix(4, 0) = "4"
    : MSFlexGrid1.TextMatrix(5, 0) = "5"
    : MSFlexGrid1.TextMatrix(6, 0) = "6"
    : MSFlexGrid1.TextMatrix(7, 0) = "7"
    : MSFlexGrid1.TextMatrix(8, 0) = "8"
    : MSFlexGrid1.TextMatrix(9, 0) = "9"
    : MSFlexGrid1.TextMatrix(10, 0) = "10"
    :
    : End Sub
    :
    : Private Sub upd_Change()
    : Label6.Caption = Format(upd.Value, "0")
    : End Sub
    :
    : Private Sub UpDown1_DownClick()
    : If CurrentRow > MSFlexGrid1.FixedRows + 1 Then
    : CurrentRow = CurrentRow - 1
    : With MSFlexGrid1
    : Dim a As Long
    : [blue]For a = 1 To 5 'Needs to be 1 to 5 so it sets the value for all 5 text boxes[/blue]
    : fred(a).Text = .TextMatrix(CurrentRow, a)
    : Next a
    : End With
    : End If
    : End Sub
    :
    : Private Sub UpDown1_UpClick()
    : If CurrentRow < MSFlexGrid1.FixedRows - 1 Then
    : CurrentRow = CurrentRow + 1
    : With MSFlexGrid1
    : Dim a As Long
    : [blue]For a = 0 To 3 'Needs to be 1 to 5 so it sets the value for all 5 text boxes [/blue]
    : fred(a).Text = .TextMatrix(CurrentRow, a)
    : Next a
    : End With
    : End If
    : End Sub[/code}
    :
    : I don't know if that solves your problem. If it didn't could you post back with more info.


    Sorry I forgot to change the last line that was in blue

    [blue]For a = 0 To 3 'Needs to be 1 to 5 so it sets the value for all 5 text boxes [/blue]

    should have been

    [blue]For a = 1 To 5 'Needs to be 1 to 5 so it sets the value for all 5 text boxes [/blue]


  • : : I don't know if that solves your problem. If it didn't could you post back with more info.
    :
    :
    : Sorry I forgot to change the last line that was in blue
    :
    : [blue]For a = 0 To 3 'Needs to be 1 to 5 so it sets the value for all 5 text boxes [/blue]
    :
    : should have been
    :
    : [blue]For a = 1 To 5 'Needs to be 1 to 5 so it sets the value for all 5 text boxes [/blue]
    :
    :

    thankyou for your help, my problem is that i cant seem to get the array to go to the following record, and i think that the updown control doesnt move back and forth the records,

    you said in a previous replay that it works on your computer would it be much to ask for you to send it too me. seeing my problems are presisting.
    the email address is as_lexus75@hotmail.com ( thats an underscore between the as and lex)
    thanks

  • : thankyou for your help, my problem is that i cant seem to get the array to go to the following record, and i think that the updown control doesnt move back and forth the records,
    :
    : you said in a previous replay that it works on your computer would it be much to ask for you to send it too me. seeing my problems are presisting.
    : the email address is as_lexus75@hotmail.com ( thats an underscore between the as and lex)
    : thanks
    :

    When I said it was working fine on my computer I ment that the line that you said was coming up with an error wasn't coming up with the error on my computer. You already have the exact code that I was using. I never tested the updown control.

    I found a logic error or two in the code I gave you, hopefully that is all that is causing the problem, however I sort of think that it won't quite fix it. Try the code below (changes are in blue) and if this dosen't work, email me your project and I'll see if I can get it working for you. My email address is kerwinm@comcen.com.au

    [code]Private CurrentRow As Long
    Private Sub Command1_Click()
    Dim Name As String, Ma As Integer, Maa As Integer, Maaa As Integer 'I don't think you need this line, as none of the variables are used in the sub
    Dim a As Long
    For a = 1 To 5 'I think you need 5 text boxes in the control array with index values from 1 To 5
    MSFlexGrid1.TextMatrix(CurrentRow, a) = fred(a).Text
    Next a
    End Sub

    Private Sub Form_Load()
    CurrentRow = InitialRow 'InitialRow needs to be replaced with the row number which contains the data which is loaded into the textboxes when the form first loads. An example is found on the line below:
    'CurrentRow = 1

    MSFlexGrid1.TextMatrix(0, 1) = "Name"
    MSFlexGrid1.TextMatrix(0, 2) = "Mark 1"
    MSFlexGrid1.TextMatrix(0, 3) = "Mark 2"
    MSFlexGrid1.TextMatrix(0, 4) = "Mark 3"
    MSFlexGrid1.TextMatrix(0, 5) = "Average"
    MSFlexGrid1.TextMatrix(1, 0) = "1"
    MSFlexGrid1.TextMatrix(2, 0) = "2"
    MSFlexGrid1.TextMatrix(3, 0) = "3"
    MSFlexGrid1.TextMatrix(4, 0) = "4"
    MSFlexGrid1.TextMatrix(5, 0) = "5"
    MSFlexGrid1.TextMatrix(6, 0) = "6"
    MSFlexGrid1.TextMatrix(7, 0) = "7"
    MSFlexGrid1.TextMatrix(8, 0) = "8"
    MSFlexGrid1.TextMatrix(9, 0) = "9"
    MSFlexGrid1.TextMatrix(10, 0) = "10"

    End Sub

    Private Sub upd_Change()
    Label6.Caption = Format(upd.Value, "0")
    End Sub

    Private Sub UpDown1_DownClick()
    [blue]If CurrentRow > MSFlexGrid1.FixedRows Then[/blue]
    CurrentRow = CurrentRow - 1
    With MSFlexGrid1
    Dim a As Long
    For a = 1 To 5 'Needs to be 1 to 5 so it sets the value for all 5 text boxes
    fred(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub

    Private Sub UpDown1_UpClick()
    If CurrentRow < MSFlexGrid1.FixedRows - 1 Then
    CurrentRow = CurrentRow + 1
    With MSFlexGrid1
    Dim a As Long
    For a = 1 To 5 'Needs to be 1 to 5 so it sets the value for all 5 text boxes
    fred(a).Text = .TextMatrix(CurrentRow, a)
    Next a
    End With
    End If
    End Sub[/code]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories