piggybank1974
09-29-2004, 05:27 AM
Hi there,
I'm trying again to change my code from VB6 to VB.net.
I have the following Structure(In A Class)
Private Structure TableData
Dim TableID As Long ' An identification number for each table.
Dim LBDescription As String ' This is the List Box description (for editing) that record.
Dim TextDescription As String ' This is a viewable text decription of the table that the Client side will see.
Dim ImageFile As String 'This is a Image of the house that the Client will see.
Dim MaximumPlayers As Long ' The maximum number of players on the table.
Dim NumberOfDecksUsed As Long
Dim TimeLimit As Long ' The amount of time that each player has before they miss a turn.
Dim Reshuffle As Long ' The amount of deals before the cards are reshuffled again.
Dim CancelKing As Long ' The player can/cannot cancel out the king of hearts.
Dim AutoSortHand As Long ' The software automatically sorts out your cards for you.
Dim CardSetName As String
Dim Stake As Decimal
Dim TableStatus As Byte
Dim PlayerToDeal As Long
Dim NextPlayer As Integer
Dim Players() As PlayerData
Dim Deal As DealData
Dim StingerCards() As StingerCardData
Dim Deck As DecksData
Dim ReShuffleStatus As Byte
Dim TimerCount As Byte
End Structure
In the class i have the following
'Variables Defined
Private Tables() As TableData
Private TableID As Integer
Private TableTotals As Integer
--Note-- I did not post the other structures(StingerCardData,DecksData etc)
but here is my Load tables method
#Region "LoadTables Method"
Public Sub LoadTables()
Dim FileHandle As Integer
Dim A As Integer
Dim B As Integer
Dim C As Integer
FileHandle = FreeFile()
ReDim Tables(0)
A = 0
If Len(App_Path() & "DataFiles\Tables.dat") Then
FileOpen(FileHandle, App_Path() & "DataFiles\Tables.dat", OpenMode.Binary)
Console.WriteLine(App_Path())
Do While Not EOF(FileHandle)
FileGet(FileHandle, OpenMode.Random, Tables(A))
ReDim Tables(A).Deck.Cards(0)
ReDim Tables(A).StingerCards(5)
For B = 0 To 5
Tables(A).StingerCards(B).Value = 0
Next B
'If Tables(A).TableID > 1 Then
'Load(FrmMain.TableTimer(Tables(A).TableID))
'End If
A = A + 1
ReDim Preserve Tables(A)
TableTotals = TableTotals + 1
Loop
FileClose(FileHandle)
TableTotals = TableTotals - 2
For B = 0 To UBound(Tables)
If Tables(B).TableID > TableID Then
TableID = Tables(B).TableID
End If
Next B
ReDim Preserve Tables(A - 2)
End If
End Sub
#End Region
I want to use the new VB.NET way of loading and accessing a data file but I'm having problems with system.IO, because i'm not sure on how to change it to make it work.
the pig..
I'm trying again to change my code from VB6 to VB.net.
I have the following Structure(In A Class)
Private Structure TableData
Dim TableID As Long ' An identification number for each table.
Dim LBDescription As String ' This is the List Box description (for editing) that record.
Dim TextDescription As String ' This is a viewable text decription of the table that the Client side will see.
Dim ImageFile As String 'This is a Image of the house that the Client will see.
Dim MaximumPlayers As Long ' The maximum number of players on the table.
Dim NumberOfDecksUsed As Long
Dim TimeLimit As Long ' The amount of time that each player has before they miss a turn.
Dim Reshuffle As Long ' The amount of deals before the cards are reshuffled again.
Dim CancelKing As Long ' The player can/cannot cancel out the king of hearts.
Dim AutoSortHand As Long ' The software automatically sorts out your cards for you.
Dim CardSetName As String
Dim Stake As Decimal
Dim TableStatus As Byte
Dim PlayerToDeal As Long
Dim NextPlayer As Integer
Dim Players() As PlayerData
Dim Deal As DealData
Dim StingerCards() As StingerCardData
Dim Deck As DecksData
Dim ReShuffleStatus As Byte
Dim TimerCount As Byte
End Structure
In the class i have the following
'Variables Defined
Private Tables() As TableData
Private TableID As Integer
Private TableTotals As Integer
--Note-- I did not post the other structures(StingerCardData,DecksData etc)
but here is my Load tables method
#Region "LoadTables Method"
Public Sub LoadTables()
Dim FileHandle As Integer
Dim A As Integer
Dim B As Integer
Dim C As Integer
FileHandle = FreeFile()
ReDim Tables(0)
A = 0
If Len(App_Path() & "DataFiles\Tables.dat") Then
FileOpen(FileHandle, App_Path() & "DataFiles\Tables.dat", OpenMode.Binary)
Console.WriteLine(App_Path())
Do While Not EOF(FileHandle)
FileGet(FileHandle, OpenMode.Random, Tables(A))
ReDim Tables(A).Deck.Cards(0)
ReDim Tables(A).StingerCards(5)
For B = 0 To 5
Tables(A).StingerCards(B).Value = 0
Next B
'If Tables(A).TableID > 1 Then
'Load(FrmMain.TableTimer(Tables(A).TableID))
'End If
A = A + 1
ReDim Preserve Tables(A)
TableTotals = TableTotals + 1
Loop
FileClose(FileHandle)
TableTotals = TableTotals - 2
For B = 0 To UBound(Tables)
If Tables(B).TableID > TableID Then
TableID = Tables(B).TableID
End If
Next B
ReDim Preserve Tables(A - 2)
End If
End Sub
#End Region
I want to use the new VB.NET way of loading and accessing a data file but I'm having problems with system.IO, because i'm not sure on how to change it to make it work.
the pig..