Click here to Skip to main content
15,912,400 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: open File Pin
Guffa30-Sep-06 3:51
Guffa30-Sep-06 3:51 
QuestionFile Type Pin
samira forooghi30-Sep-06 3:07
samira forooghi30-Sep-06 3:07 
AnswerRe: File Type Pin
Dave Kreskowiak1-Oct-06 14:42
mveDave Kreskowiak1-Oct-06 14:42 
QuestionMatrix Report Pin
microuser_200030-Sep-06 2:06
microuser_200030-Sep-06 2:06 
QuestionSharing Display Pictures in Messenger Pin
freefika30-Sep-06 1:09
freefika30-Sep-06 1:09 
Questionprivate variable not retaining its value Pin
jon-8029-Sep-06 22:23
professionaljon-8029-Sep-06 22:23 
AnswerRe: private variable not retaining its value Pin
Guffa29-Sep-06 23:08
Guffa29-Sep-06 23:08 
QuestionRe: private variable not retaining its value Pin
jon-8030-Sep-06 0:30
professionaljon-8030-Sep-06 0:30 
True, I actually excluded parts of the code intentionally (remarked with ...). I have updated the code to create a new row each time (see below), but the data set is still not being updated with rows.


Imports Rover
Public Class Plateau

'Singleton class. Must use Instance to initialize.
Private Sub New()
initDataSource()
End Sub

Public Shared ReadOnly Instance As Plateau = New Plateau

Private intXPositions As Integer
Public Property XPositions() As Integer
Get
Return intXPositions
End Get
Set(ByVal Value As Integer)
intXPositions = Value
End Set
End Property

Private intYPositions As Integer
Public Property YPositions() As Integer
Get
Return intYPositions
End Get
Set(ByVal Value As Integer)
intYPositions = Value
End Set
End Property

Public ReadOnly dsPlateauPosition As New DataSet("PlateauPositions")

Public Function isOccupied(ByVal Location As Coordinate) As Boolean

End Function

Public Function setOccupied(ByVal Location As Coordinate) As Boolean

End Function

Public Function clearOccupied(ByVal Location As Coordinate) As Boolean

End Function


Private Sub initDataSource()

'Create PlateauPostions, a working dataset that retains information about
'positions occupied on the grid.
Dim dtPlateauPositions As New DataTable("PlateauPositions")

'define attributes
With dtPlateauPositions
.Columns.Add("xPosition", System.Type.GetType("System.Int32"))
.Columns.Add("yPosition", System.Type.GetType("System.Int32"))
.Columns.Add("occupied", System.Type.GetType("System.Boolean"))
End With

'enforce composite primary key
Dim colPrimaryKey(1) As DataColumn
colPrimaryKey(0) = New DataColumn("xPosition")
colPrimaryKey(1) = New DataColumn("yPosition")

'create dataset
dsPlateauPosition.Tables.Add(dtPlateauPositions)

'initialize positions as not occupied
Dim rowNew As DataRow

Dim intXCount, intYCount As Integer
For intXCount = 0 To intXPositions - 1
For intYCount = 0 To intYPositions - 1

rowNew.Item("xPosition") = intXCount
rowNew.Item("yPosition") = intYCount
rowNew.Item("occupied") = False

rowNew = dtPlateauPositions.NewRow() 'updated!
dtPlateauPositions.Rows.Add(rowNew)

Next intYCount
Next intXCount

End Sub

End Class


Jon
AnswerRe: private variable not retaining its value Pin
Guffa30-Sep-06 6:56
Guffa30-Sep-06 6:56 
GeneralRe: private variable not retaining its value Pin
jon-8030-Sep-06 8:42
professionaljon-8030-Sep-06 8:42 
Questionnetwork Pin
fatidarya29-Sep-06 19:54
fatidarya29-Sep-06 19:54 
AnswerRe: network Pin
Dave Kreskowiak1-Oct-06 14:44
mveDave Kreskowiak1-Oct-06 14:44 
GeneralRe: network Pin
fatidarya1-Oct-06 20:29
fatidarya1-Oct-06 20:29 
GeneralRe: network Pin
Dave Kreskowiak2-Oct-06 3:12
mveDave Kreskowiak2-Oct-06 3:12 
QuestionData Source name not defined and default driver specified Pin
bony_baba29-Sep-06 18:51
bony_baba29-Sep-06 18:51 
AnswerRe: Data Source name not defined and default driver specified Pin
Dave Kreskowiak1-Oct-06 14:46
mveDave Kreskowiak1-Oct-06 14:46 
QuestionHow to deploy a project? Pin
cstrader23229-Sep-06 17:37
cstrader23229-Sep-06 17:37 
AnswerRe: How to deploy a project? Pin
Dave Kreskowiak1-Oct-06 14:51
mveDave Kreskowiak1-Oct-06 14:51 
QuestionUnable to shut down windows with VB.Net App loaded. Pin
Dick Bellnier29-Sep-06 14:52
Dick Bellnier29-Sep-06 14:52 
AnswerRe: Unable to shut down windows with VB.Net App loaded. Pin
Dave Kreskowiak1-Oct-06 14:55
mveDave Kreskowiak1-Oct-06 14:55 
QuestionReading and renaming Excel Files Help Needed Pin
CraigBob29-Sep-06 13:36
CraigBob29-Sep-06 13:36 
Questionhow to reflect changes Pin
praveen kumar mahto29-Sep-06 3:09
praveen kumar mahto29-Sep-06 3:09 
AnswerRe: how to reflect changes Pin
Guffa29-Sep-06 3:27
Guffa29-Sep-06 3:27 
AnswerRe: how to reflect changes Pin
Kschuler29-Sep-06 10:33
Kschuler29-Sep-06 10:33 
Questioncombobox sort/index problem Pin
chrishowell29-Sep-06 1:43
chrishowell29-Sep-06 1:43 

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.