关于数据类型的问题 [英] Question About Data Types
问题描述
嗨!
我是VB.net的新手,但我知道可以潜入。我想写一篇文章
冒险但是我我在如何存储
库存物品,字符等数据时遇到问题。现在,我有三个房间,但是有很多关于如何判断它们是否应该出现在你的
(列表框)库存或房间内的物品的if / then
。
有关存储此信息的位置的任何建议吗?以下是我的
代码示例:
公共类Form1
继承System.Windows.Forms。表格
Dim lecroneLivingRoom As New room()
Dim lecroneKitchen As New room()
Dim lecroneDen As New room()
Dim wigwam As New items()
昏暗的电视作为新项目()
Dim atari As New items()
Dim locale As String
#Region" Windows窗体设计器生成的代码
Public Sub New()
MyBase.New()
''Windows窗体设计器需要此调用。
InitializeComponent()
''在InitializeComponent之后添加任何初始化()致电
结束子
''表格覆盖处理以清理组件列表。
受保护的重载覆盖子处理(ByVal处理为布尔值)
如果处置则
如果不是(组件无效)则
components.Dispose()
结束如果
结束如果
MyBase.Dispose(处理)
结束子
''Windows窗体设计师要求
私有组件As System.ComponentModel.IContainer
''注意:Windows窗体设计器需要以下步骤
''它可以使用Windows窗体设计器进行修改。
''不要使用代码编辑器修改它。
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents mainLbl As System.Windows .Forms.Label
Friend WithEvents itemsList As System.Windows.Forms.ListBox
Friend WithEvents inventoryList As System.Windows.Forms.ListBox
Friend WithEvents lookBtn As System.Windows.Forms.Button
Friend WithEvents dropBtn As System.Windows.Forms.Button
Friend WithEvents talkBtn As System.Windows.Forms.Button
Friend WithEvents useBtn As System.Windows.Forms.Button
Friend WithEvents getBtn As System.Windows.Forms.Button
Friend WithEvents northBtn As System.Windows.Forms.Button
Friend WithEvents westBtn As Sy stem.Windows.Forms.Button
Friend WithEvents southBtn As System.Windows.Forms.Button
Friend WithEvents eastBtn As System.Windows。 Forms.Button
< System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.mainLbl = New System.Windows.Forms.Label()
Me.inventoryList = New System。 Windows.Forms.ListBox()
Me.itemsList = New System.Windows.Forms.ListBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 =新的System.Windows.Forms.Label()
Me.northBtn = New System.Windows.Forms.Button()
Me.westBtn = New System.Windows.Forms.Button()
Me .southBtn = New System.Windows.Forms.Button()
Me.eastBtn = New System.Windows.Forms.Button()
Me.talkBtn = New System.Windows.Forms.Button()
Me.useBtn = New System.Windows.Forms.Button()
Me.lookBtn = New System.Windows.Forms.Button()
Me.dropBtn = New System.Windows.Forms.Button()
>
Me.getBtn = New System.Windows.Forms.Button()
Me.SuspendLayout()
''
''mainLbl
''
Me.mainLbl。 Location = New System.Drawing.Point(8,8)
Me.mainLbl.Name =" mainLbl"
Me.mainLbl .Size = New System.Drawing.Size(448,136)
Me.mainLbl.TabIndex = 0
''
''inventoryList
''
Me.inventoryList.Location = New System.Drawing.Point (480,32)
Me.inventoryList.Name =" inventoryList"
Me.inventoryList.Size = New System.Drawing。大小(128,121)
Me.inventoryList.TabIndex = 1
''
''itemsList
''
Me.itemsList.Location = New System.Drawing.Point(480,200)
Me.itemsList.Name =" itemsList"
Me.itemsList.Size = New System.Drawing.Size(128,121)
Me.itemsList.TabIndex = 2
''
''标签2
''
Me.Label2.Location = New System.Drawing.Point(480,8)
Me.Label2.Name =" Label2"
Me.Label2.Size = New System.Drawing.Size(128,16)
Me.Label2.TabIndex = 3
Me.Label2.Text ="库存>
''
''Label3
< br $>
''
Me.Label3.Location =新System.Drawing.Point(480,160)
Me.Label3.Name =" Label3"
Me.Label3.Size = New System.Drawing.Size(128,24)
Me.Label3.TabIndex = 4
Me.Label3.Text =房间内的物体/人物
''
''northBtn
''
Me.northBtn.Location =新的System.Drawing。 Point(208,176)
Me.northBtn.Name =" northBtn"
Me.northBtn.TabIndex = 5
Me.northBtn.Text =" North"
''
''westBtn
''
Me.westBtn.Location =新的System.Drawing.Point(136 ,200)
Me.westBtn.Name =" westBtn"
Me.westBtn.TabIndex = 6
Me.westBtn.Text =" West"
''
''southBtn
''
Me.southBtn.Location =新的System.Drawing.Point(208,224)
Me.southBtn.Name =" southBtn"
Me.southBtn.TabIndex = 7
Me.southBtn.Text =" South" ;
''
''eastBtn
''
Me.eastBtn.Location = New System.Drawing.Point(280,200)
Me.eastBtn.Name =" eastBtn"
Me.eastBtn.TabIndex = 8
Me.eastBtn.Text =&qu ot;东
''
''talkBtn
''
Me.talkBtn.Location = New System.Drawing.Point(176,288)
Me.talkBtn.Name =" talkBtn"
Me.talkBtn.TabIndex = 9
Me.talkBtn.Text =" Talk"
''
''useBtn
''
Me.useBtn.Location = New System.Drawing.Point(88,288)
Me.useBtn.Name =" useBtn"
Me.useBtn.TabIndex = 10
Me.useBtn.Text =使用
''
''lookBtn
''
Me.lookBtn.Location = New System.Drawing.Point(0,288)
Me.lookBtn.Name =" lookBtn"
Me.lookBtn.TabIndex = 11
Me .lookBtn.Text ="看>
''
''dropBtn
''
Me.dropBtn.Location = New System.Drawing.Point(352,288)
Me.dropBtn .Name =" dropBtn"
Me.dropBtn.TabIndex = 12
Me.dropBtn.Text =" Drop"
''
''getBtn
''
Me.getBtn.Location = New System.Drawing.Point(264,288)
Me.getBtn.Name =" getBtn"
Me.getBtn.TabIndex = 14
Me.getBtn.Text =" Get"
''
''Form1
''
Me.AutoScaleBaseSize = New System.Drawing.Size(5 ,13)
Me.ClientSize = New System.Drawing.Size(616,374)
Me.Controls.AddRange(新系统) .Windows.Forms.Control(){Me.getBtn,
Me.dropBtn,Me.lookBtn,Me.useBtn,Me.talkBtn,Me.eastBtn,Me.southBtn,
Me.westBtn,Me.northBtn,Me.Label3,Me.Label2,Me.itemsList ,
Me.inventoryList,Me.mainLbl})
Me.Name =" Form1"
Me.Text =Gravel Ridge Adventure 0.0
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub westBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理westBtn。点击
REM客厅到厨房
如果locale =" lecroneLivingRoom"然后
locale =" lecroneKitchen"
itemsList.Items.Remove(" wigwam")
lecroneKitchen.desc =你在Lecrone厨房里
mainLbl.Text = lecroneKitchen.desc& _
天花板上挂着一个波波灯,上面有一个 _
& 柳条灯具。它来回移动为 _
& 如果有人最近哼了一声。起居室 _
& is to the East
结束如果
结束子
私人子按钮6_Click (ByVal sender As System.Object,ByVal e As
System.EventArgs)处理useBtn.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load
mainLbl.Text =" ;欢迎来到Gravel Ridge Adventure"
lecroneLivingRoom.desc ="这是Lecrone Living Room"
locale =" lecroneLivingRoom"
mainLbl.Text = mainLbl.Text& lecroneLivingRoom.desc
wigwam.itemExist = True
如果wigwam.itemExist = True那么
mainLbl.Text = mainLbl.Text& 这里有一个小屋。
itemsList.Items.Add(" wigwam")
结束如果
End Sub
Private Sub itemsList_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)Handles itemsList.SelectedIndexChanged
End Sub
Private Sub inventoryList_SelectedIndexChanged(ByVal sender As
System.Object,ByVal e作为System.EventArgs)处理
inventoryList.SelectedIndexChanged
End Sub
Private Sub lookBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理lookBtn.Click
如果itemsList.SelectedItem =" wigwam"然后
mainLbl.Text = mainLbl.Text& 这是一件超级英雄夹克
结束如果
结束子
私人子dropBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理dropBtn.Click
End Sub
Private Sub getBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理getBtn.Click
REM获取WigWam
如果locale =" lecroneLivingRoom"并且wigwam.itemExist = True然后
如果itemsList.SelectedItem =" wigwam"然后
inventoryList.Items.Add(" wigwam")
itemsList.Items.Remove(" wigwam")
wigwam.itemExist = False
wigwam.itemHave = True
结束如果
<如果
REM获取Atari
并且atari.itemExist = True然后
如果itemsList.SelectedItem =" atari"然后
inventoryList.Items.Add(&atari)
itemsList.Items.Remove(" atari")
atari.itemExist = False
atari.itemHave = True
结束如果
结束如果
End Sub
Private Sub northBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理northBtn.Click
REM Den到客厅
如果locale =" lecroneDen" ;然后
locale =" lecroneLivingRoom"
itemsList.Items.Remove(" atari")
结束如果
如果wigwam.itemHave = True那么
mainLbl.Text = lecroneLivingRoom.desc
否则
mainLbl.Text = lecroneLivingRoom.desc& 这里有一个小屋。
itemsList.Items.Add(" wigwam")
结束如果
End Sub
Private Sub eastBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)Handles eastBtn.Click
REM厨房到客厅
如果locale =" lecroneKitchen"然后
locale =" lecroneLivingRoom"
结束如果
REM Living Room To EAST
如果locale =" lecroneLivingRoom"然后
mainLbl.Text =你不能那样
结束如果
如果wigwam.itemHave = True那么
itemsList.Items.Clear()
Else
>
mainLbl.Text = mainLbl.Text& 这里有一个小屋。
itemsList.Items.Add(" wigwam")
结束如果
End Sub
Private Sub southBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)Handles southBtn.Click
如果locale =" lecroneLivingRoom"然后
locale =" lecroneDen"
itemsList.Items.Remove(" wigwam")
lecroneDen.desc ="你在Lecrone Den。
mainLbl.Text = lecroneDen.desc& 这个房间可能有 _
& 曾经是一个车库。有一张沙发和 _
& 这里有电视。
atari.itemExist =真
如果atari.itemExist = True则
>
mainLbl.Text = lecroneDen.desc& 这个房间可能有 _
& 曾经是一个车库。有一张沙发和 _
& 这里的电视。 &安培; 这里有一个Atari
itemsList.Items.Add(&atari)
结束如果
结束如果
结束次级
结束班级
和一个单独的课程模块:
选项严格关闭
选项明确开启
朋友教室
Public desc As String
结束课
朋友班人
< br $>
结束班
朋友类商品
公共itemExist作为布尔值
Public itemHave As Boolean
Public itemDesc As String
End Class
"布赖恩" <峰; br *********** @ yahoo.com> schrieb嗨!
我是VB.net的新手,但我知道有点潜入。我想做一个文本冒险但是我有我想如何存储库存物品,人物等的数据的问题。现在,我有三个房间,但有很多关于如何判断它们是否应该出现在你的(列表框)库存或房间内的物品的陈述。
有关存储此信息的位置的任何建议?以下是我的代码示例:
[代码]
您能再次发布代码吗?首先将其复制到记事本,然后从
记事本复制到发布。这样可以保持标识并且不会插入空白
行。我们阅读起来要容易得多。
-
Armin
http://www.plig。 net / nnq / nquote.html
http://www.netmeister.org/news/learn2quote.html
公开Class Form1
继承System.Windows.Forms.Form
Dim lecroneLivingRoom As New room()
Dim lecroneKitchen As New room ()
Dim lecroneDen As New room()
Dim wigwam As New items()
Dim television As New items()
Dim atari As New items()
Dim locale As String
#Region" Windows窗体设计器生成的代码
Public Sub New()
MyBase.New()
' 'Windows窗体设计器需要此调用。
InitializeComponent()
''在InitializeComponent()调用后添加任何初始化
< br $>
结束子
''表格覆盖处理以清理组件列表。
受保护的重载覆盖子处理(ByVal处理为布尔)
如果处置那么
如果不是(组件什么都没有)那么
components.Dispose()
结束如果
结束如果
MyBase.Dispose(处置)
结束子
'' Windows窗体设计器要求
私有组件As System.ComponentModel.IContainer
''注意:Windows窗体设计器需要以下过程
''可以使用Windows窗体设计器修改它。
''不要莫使用代码编辑器来区分它。
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents mainLbl As System.Windows.Forms.Label
Friend WithEvents itemsList As System.Windows.Forms.ListBox
Friend WithEvents inventoryList As System.Windows.Forms .ListBox
Friend WithEvents lookBtn As System.Windows.Forms.Button
Friend WithEvents dropBtn As System.Windows.Forms.Button
Friend WithEvents talkBtn As System.Windows.Forms.Button
Friend WithEvents useBtn As System.Windows.Forms.Button
Friend WithEvents getBtn As System.Windows.Forms.Button
Friend WithEvents northBtn As System.Windows.Forms.Button
Friend WithEvents westBtn As System.Windows.Forms.Button
Friend WithEvents southBtn As System.Windows .Forms.Button
Friend WithEvents eastBtn As System.Windows.Forms.Button
& LT; System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.mainLbl = New System.Windows.Forms.Label()
Me.inventoryList = New System。 Windows.Forms.ListBox()
Me.itemsList = New System.Windows.Forms.ListBox()
Me.Label2 = New System.Windows.Forms.Label( )
Me.Label3 = New System.Windows.Forms.Label()
Me.northBtn = New System.Windows.Forms.Button()
Me.westBtn = New System.Windows.Forms.Button()
Me.southBtn = New System.Windows.Forms.Button()
Me.eastBtn = New System.Windows.Forms.Button()
Me.talkBtn = New System.Windows.Forms.Button()
Me.useBtn = New System.Windows。 Forms.Button()
Me.lookBtn = New System.Windows.Forms.Button()
Me.dropBtn = New System.Windows.Forms.Button()
Me.getBtn = New System.Windows.Forms.Button()
Me.SuspendLayout()
''
''mainLbl
''
Me.mainLbl.Location = New System.Dra wing.Point(8,8)
Me.mainLbl.Name =" mainLbl"
Me.mainLbl.Size = New System.Drawing.Size(448,136 )
Me.mainLbl.TabIndex = 0
''
''inventoryList
''
Me.inventoryList.Location = New System.Drawing.Point(480,32)
Me.inventoryList.Name =" inventoryList"
Me。 inventoryList.Size = New System.Drawing.Size(128,121)
Me.inventoryList.TabIndex = 1
''
'' itemsList
''
Me.itemsList.Location = New System.Drawing.Point(480,200)
Me.itemsList.Name = " itemsList"
Me.itemsList.Size = New System.Drawing.Size(128,121)
Me.itemsList.TabIndex = 2
''
''Label2
''
Me.Label2.Location =新System.Drawing.Point(480,8)
Me.Label2.Name =" Label2"
Me.Label2.Size = New System.Drawing.Size(128,16)
Me.Label2.TabIndex = 3
Me.Label2.Text ="库存>
''
'' Label3
''
Me.Label3.Location = New System.Drawing.Point(480,160)
Me.Label3.Name = " Label3"
Me.Label3.Size = New System.Drawing.Size(128,24)
Me.Label3.TabIndex = 4
Me.Label3.Text =房间里的物件/人物
''
''northBtn
''
Me.northBtn.Location = New System.Drawing.Point(208,176)
Me.northBtn.Name =" northBtn"
Me。 northBtn.TabIndex = 5
Me.northBtn.Text =" North"
''
''westBtn
''
Me.westBtn.Location = New System.Drawing.Point(136,200)
Me.westBtn.Name =" westBtn"
Me.westBtn.TabIndex = 6
Me.westBtn.Text =" West"
''
'' southBtn
'
Me.southBtn.Location = New System.Drawing.Point(208,224)
Me.southBtn.Name =" southBtn"
Me.southBtn.TabIndex = 7
Me.southBtn.Text =" South"
''
''eastBtn
''
Me.eastBtn.Location = New System.Drawing.Point(280,200)
Me.eastBtn.Name =" eastBtn"
Me.eastBtn.TabIndex = 8
Me.eastBtn.Text =" East"
''
''talkBtn
''
Me.talkBtn.Location = New System.Drawing.Point(176,288)
Me.talkBtn .Name =" talkBtn"
Me.talkBtn.TabIndex = 9
Me.talkBtn.Text =" Talk"
''
''useBtn
''
Me.useBtn.Location = New System.Drawing.Point(88,288)
Me.useBtn.Name =" useBtn"
Me.useBtn.TabIndex = 10
Me.useBtn.Text =" Use"
''
''lookBtn
''
Me.lookBtn.Location = New System.Drawing.Point(0,288)
Me.lookBtn.Name =" lookBtn"
Me.lookBtn.TabIndex = 11
Me.lookBtn.Text =" Look"
''
''dropBtn
''
Me.dropBtn.Location = New System.Drawing.Point(352,288)
Me.dropBtn.Name =" dropBtn"
Me.dropBtn.TabIndex = 12
Me.dropBtn.Text =" Drop"
''
''getBtn
''
Me.getBtn.Location = New System.Drawing。 Point(264,288)
Me.getBtn.Name =" getBtn"
Me.getBtn.TabIndex = 14
Me.getBtn .Text ="获取>
''
''Form1
''
Me.AutoScaleBaseSize = New System.Drawing.Size(5,13)
Me.ClientSize = New System.Drawing.Size(616,374)
Me.Controls.AddRange(新系统.Windows.Forms.Control(){ Me.getBtn,
Me.dropBtn,Me.lookBtn,Me.useBtn,Me.talkBtn,Me.eastBtn,Me.southBtn,
Me.westBtn,Me。 northBtn,Me.Label3,Me.Label2,Me.itemsList,
Me.inventoryList,Me.mainLbl})
Me.Name =" Form1"
Me.Text =" Gravel Ridge Adventure 0.0"
Me.ResumeLayout(False)
End Sub
< br $>
#End Region
Private Sub westBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理westBtn 。点击
REM到厨房的客厅
如果locale =" lecroneLivingRoom"然后
locale =" lecroneKitchen"
itemsList.Items.Remove(" wigwam")
lecroneKitchen.desc ="你是在Lecrone Kitchen中
mainLbl.Text = lecroneKitchen.desc& _
天花板上挂着一个波波灯,上面有一个 _
& 柳条灯具。它来回移动为 _
& 如果有人最近哼了一声。起居室 _
& is to the East
结束如果
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)处理useBtn.Click
End Sub
Private Sub Form1_Load(ByVal) sender As System.Object,ByVal e As
System.EventArgs)Handles MyBase.Load
mainLbl.Text =" Welcome to Gravel Ridge Adventure"
lecroneLivingRoom.desc ="这是Lecrone Living Room"
locale =" lecroneLivingRoom"
mainLbl.Text = mainLbl.Text& lecroneLivingRoom.desc
wigwam.itemExist = True
如果wigwam.itemExist = True那么
mainLbl.Text = mainLbl.Text& 这里有一个小屋。
itemsList.Items.Add(" wigwam")
结束如果
End Sub
Private Sub itemsList_SelectedIndexChanged(ByVal sender As
System.Object,ByVal e As System.EventArgs)Handles
itemsList.SelectedIndexChanged
End Sub
Private Sub inventoryList_SelectedIndexChanged(ByVal sender As
System.Object,ByVal e作为System.EventArgs)处理
inventoryList.SelectedIndexChanged
End Sub
Private Sub lookBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理lookBtn.Click
如果itemsList.SelectedItem =" wigwam"然后
mainLbl.Text = mainLbl.Text& 这是一个超级英雄夹克
结束如果
结束子
Private Sub dropBtn_Click(ByVal sender As System.Object ,ByVal e As
System.EventArgs)处理dropBtn.Click
End Sub
Private Sub getBtn_Click( ByVal sender As System.Object,ByVal e As
System.EventArgs)处理getBtn.Click
REM获取WigWam
如果locale =" lecroneLivingRoom"并且wigwam.itemExist = True然后
如果itemsList.SelectedItem =" wigwam"然后
inventoryList.Items.Add(" wigwam")
itemsList.Items.Remove(" wigwam")
wigwam.itemExist = False
wigwam.itemHave = True
结束如果
结束如果
REM获取Atari
如果locale =" lecroneDen"并且atari.itemExist = True然后
如果itemsList.SelectedItem =" atari"然后
inventoryList.Items.Add(&atari)
itemsList.Items.Remove(" atari")
atari.itemExist = False
atari.itemHave = True
结束如果
结束如果
结束子
Private Sub northBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理northBtn.Click
REM Den to Living Room
如果locale =" lecroneDen"然后
locale =" lecroneLivingRoom"
itemsList.Items.Remove(" atari")
结束如果
如果wigwam.itemHave = True那么
mainLbl.Text = lecroneLivingRoom.desc
Else
mainLbl.Text = lecroneLivingRoom.desc& 这里有一个Wigwam
。
itemsList.Items.Add(" wigwam")
结束如果
End Sub
Private Sub eastBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理eastBtn.Click
REM厨房到客厅
如果locale =" lecroneKitchen"然后
locale =" lecroneLivingRoom"
结束如果
REM Living Room To EAST
如果locale =" ; lecroneLivingRoom"然后
mainLbl.Text =你不能那样
结束如果
如果wigwam.itemHave = True那么< br $>
itemsList.Items.Clear()
否则
mainLbl.Text = mainLbl.Text& 这里有一个小屋。
itemsList.Items.Add(" wigwam")
结束如果
结束Sub
Private Sub southBtn_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理southBtn.Click
如果locale =" lecroneLivingRoom"然后
locale =" lecroneDen"
itemsList.Items.Remove(" wigwam")
lecroneDen.desc ="你是在Lecrone Den。
mainLbl.Text = lecroneDen.desc& 这个房间可能有 _
& 曾经是一个车库。有一张沙发和 _
& 电视在这里。
atari.itemExist = True
如果atari.itemExist = True那么
mainLbl.Text = lecroneDen.desc &安培; 这个房间可能有 _
& 曾经是一个车库。有一张沙发和 _
& 这里的电视。 &安培; 这里有一个Atari
itemsList.Items.Add(&atari)
结束如果
结束如果
结束次级
结束班级
期权严格关闭
期权明确在
朋友教室
公共设计作为字符串
结束班级
朋友级别人士
结束课程
朋友课程项目
公共项目表现作为布尔值
Public itemHave As Boolean
Public itemDesc As String
End Class
" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道
news:OW ************** @ TK2MSFTNGP09.phx.gbl ..." Brian" <峰; br *********** @ yahoo.com> schrieb嗨!
我是VB.net的新手,但我知道有点潜入。我想做一个文本冒险但是我有我想如何存储库存物品,人物等的数据的问题。现在,我有三个房间,但有很多关于如何判断它们是否应该出现在你的(列表框)库存或房间内的物品的陈述。
有关存储此信息的位置的任何建议?以下是我的代码示例:
[code]
请您再次发布代码?首先将其复制到记事本,然后从
记事本复制到发布。这样可以保持标识并且不会插入空白的
行。我们阅读起来要容易得多。
-
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
嗨Brian,
据我了解你想要的东西,我想在这种情况下我会在
中使用XML数据集。
我认为它是一个独立的应用程序。
Cor
Hi!
I am new to VB.net but know enough to kind of dive in. I want to make a text
adventure but I am having problems in how I want to store the data for
inventory items, characters and such. Right now, I have three rooms but a
lot of if and then statements on how to tell if they should appear in your
(listboxes) inventory or items in room box.
Any suggestions on where to store this information? Here is a sample of my
code:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim lecroneLivingRoom As New room()
Dim lecroneKitchen As New room()
Dim lecroneDen As New room()
Dim wigwam As New items()
Dim television As New items()
Dim atari As New items()
Dim locale As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
''This call is required by the Windows Form Designer.
InitializeComponent()
''Add any initialization after the InitializeComponent() call
End Sub
''Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
''Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
''NOTE: The following procedure is required by the Windows Form Designer
''It can be modified using the Windows Form Designer.
''Do not modify it using the code editor.
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents mainLbl As System.Windows.Forms.Label
Friend WithEvents itemsList As System.Windows.Forms.ListBox
Friend WithEvents inventoryList As System.Windows.Forms.ListBox
Friend WithEvents lookBtn As System.Windows.Forms.Button
Friend WithEvents dropBtn As System.Windows.Forms.Button
Friend WithEvents talkBtn As System.Windows.Forms.Button
Friend WithEvents useBtn As System.Windows.Forms.Button
Friend WithEvents getBtn As System.Windows.Forms.Button
Friend WithEvents northBtn As System.Windows.Forms.Button
Friend WithEvents westBtn As System.Windows.Forms.Button
Friend WithEvents southBtn As System.Windows.Forms.Button
Friend WithEvents eastBtn As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.mainLbl = New System.Windows.Forms.Label()
Me.inventoryList = New System.Windows.Forms.ListBox()
Me.itemsList = New System.Windows.Forms.ListBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.northBtn = New System.Windows.Forms.Button()
Me.westBtn = New System.Windows.Forms.Button()
Me.southBtn = New System.Windows.Forms.Button()
Me.eastBtn = New System.Windows.Forms.Button()
Me.talkBtn = New System.Windows.Forms.Button()
Me.useBtn = New System.Windows.Forms.Button()
Me.lookBtn = New System.Windows.Forms.Button()
Me.dropBtn = New System.Windows.Forms.Button()
Me.getBtn = New System.Windows.Forms.Button()
Me.SuspendLayout()
''
''mainLbl
''
Me.mainLbl.Location = New System.Drawing.Point(8, 8)
Me.mainLbl.Name = "mainLbl"
Me.mainLbl.Size = New System.Drawing.Size(448, 136)
Me.mainLbl.TabIndex = 0
''
''inventoryList
''
Me.inventoryList.Location = New System.Drawing.Point(480, 32)
Me.inventoryList.Name = "inventoryList"
Me.inventoryList.Size = New System.Drawing.Size(128, 121)
Me.inventoryList.TabIndex = 1
''
''itemsList
''
Me.itemsList.Location = New System.Drawing.Point(480, 200)
Me.itemsList.Name = "itemsList"
Me.itemsList.Size = New System.Drawing.Size(128, 121)
Me.itemsList.TabIndex = 2
''
''Label2
''
Me.Label2.Location = New System.Drawing.Point(480, 8)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(128, 16)
Me.Label2.TabIndex = 3
Me.Label2.Text = "Inventory"
''
''Label3
''
Me.Label3.Location = New System.Drawing.Point(480, 160)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(128, 24)
Me.Label3.TabIndex = 4
Me.Label3.Text = "Objects / Persons in Room"
''
''northBtn
''
Me.northBtn.Location = New System.Drawing.Point(208, 176)
Me.northBtn.Name = "northBtn"
Me.northBtn.TabIndex = 5
Me.northBtn.Text = "North"
''
''westBtn
''
Me.westBtn.Location = New System.Drawing.Point(136, 200)
Me.westBtn.Name = "westBtn"
Me.westBtn.TabIndex = 6
Me.westBtn.Text = "West"
''
''southBtn
''
Me.southBtn.Location = New System.Drawing.Point(208, 224)
Me.southBtn.Name = "southBtn"
Me.southBtn.TabIndex = 7
Me.southBtn.Text = "South"
''
''eastBtn
''
Me.eastBtn.Location = New System.Drawing.Point(280, 200)
Me.eastBtn.Name = "eastBtn"
Me.eastBtn.TabIndex = 8
Me.eastBtn.Text = "East"
''
''talkBtn
''
Me.talkBtn.Location = New System.Drawing.Point(176, 288)
Me.talkBtn.Name = "talkBtn"
Me.talkBtn.TabIndex = 9
Me.talkBtn.Text = "Talk"
''
''useBtn
''
Me.useBtn.Location = New System.Drawing.Point(88, 288)
Me.useBtn.Name = "useBtn"
Me.useBtn.TabIndex = 10
Me.useBtn.Text = "Use"
''
''lookBtn
''
Me.lookBtn.Location = New System.Drawing.Point(0, 288)
Me.lookBtn.Name = "lookBtn"
Me.lookBtn.TabIndex = 11
Me.lookBtn.Text = "Look"
''
''dropBtn
''
Me.dropBtn.Location = New System.Drawing.Point(352, 288)
Me.dropBtn.Name = "dropBtn"
Me.dropBtn.TabIndex = 12
Me.dropBtn.Text = "Drop"
''
''getBtn
''
Me.getBtn.Location = New System.Drawing.Point(264, 288)
Me.getBtn.Name = "getBtn"
Me.getBtn.TabIndex = 14
Me.getBtn.Text = "Get"
''
''Form1
''
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(616, 374)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.getBtn,
Me.dropBtn, Me.lookBtn, Me.useBtn, Me.talkBtn, Me.eastBtn, Me.southBtn,
Me.westBtn, Me.northBtn, Me.Label3, Me.Label2, Me.itemsList,
Me.inventoryList, Me.mainLbl})
Me.Name = "Form1"
Me.Text = "Gravel Ridge Adventure 0.0"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub westBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles westBtn.Click
REM living room to Kitchen
If locale = "lecroneLivingRoom" Then
locale = "lecroneKitchen"
itemsList.Items.Remove("wigwam")
lecroneKitchen.desc = "You are in the Lecrone Kitchen"
mainLbl.Text = lecroneKitchen.desc & _
"There is a Bobo light hanging from the ceiling with a " _
& "wicker light fixture. It is moving back and forth as " _
& "if someone has recently ghunked it. The living room " _
& "is to the East"
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles useBtn.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
mainLbl.Text = "Welcome To Gravel Ridge Adventure"
lecroneLivingRoom.desc = "This is the Lecrone Living Room"
locale = "lecroneLivingRoom"
mainLbl.Text = mainLbl.Text & lecroneLivingRoom.desc
wigwam.itemExist = True
If wigwam.itemExist = True Then
mainLbl.Text = mainLbl.Text & "There is a Wigwam here."
itemsList.Items.Add("wigwam")
End If
End Sub
Private Sub itemsList_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles itemsList.SelectedIndexChanged
End Sub
Private Sub inventoryList_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
inventoryList.SelectedIndexChanged
End Sub
Private Sub lookBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lookBtn.Click
If itemsList.SelectedItem = "wigwam" Then
mainLbl.Text = mainLbl.Text & "This is a superhero jacket"
End If
End Sub
Private Sub dropBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles dropBtn.Click
End Sub
Private Sub getBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles getBtn.Click
REM Getting WigWam
If locale = "lecroneLivingRoom" And wigwam.itemExist = True Then
If itemsList.SelectedItem = "wigwam" Then
inventoryList.Items.Add("wigwam")
itemsList.Items.Remove("wigwam")
wigwam.itemExist = False
wigwam.itemHave = True
End If
End If
REM Getting Atari
If locale = "lecroneDen" And atari.itemExist = True Then
If itemsList.SelectedItem = "atari" Then
inventoryList.Items.Add("atari")
itemsList.Items.Remove("atari")
atari.itemExist = False
atari.itemHave = True
End If
End If
End Sub
Private Sub northBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles northBtn.Click
REM Den to Living Room
If locale = "lecroneDen" Then
locale = "lecroneLivingRoom"
itemsList.Items.Remove("atari")
End If
If wigwam.itemHave = True Then
mainLbl.Text = lecroneLivingRoom.desc
Else
mainLbl.Text = lecroneLivingRoom.desc & "There is a Wigwam here."
itemsList.Items.Add("wigwam")
End If
End Sub
Private Sub eastBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles eastBtn.Click
REM Kitchen to Living Room
If locale = "lecroneKitchen" Then
locale = "lecroneLivingRoom"
End If
REM Living Room To EAST
If locale = "lecroneLivingRoom" Then
mainLbl.Text = "You Can''t Go That Way"
End If
If wigwam.itemHave = True Then
itemsList.Items.Clear()
Else
mainLbl.Text = mainLbl.Text & "There is a Wigwam here."
itemsList.Items.Add("wigwam")
End If
End Sub
Private Sub southBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles southBtn.Click
If locale = "lecroneLivingRoom" Then
locale = "lecroneDen"
itemsList.Items.Remove("wigwam")
lecroneDen.desc = "You are in the Lecrone Den."
mainLbl.Text = lecroneDen.desc & "This room could have " _
& "been a garage at one time. There is a couch and " _
& "television here."
atari.itemExist = True
If atari.itemExist = True Then
mainLbl.Text = lecroneDen.desc & "This room could have " _
& "been a garage at one time. There is a couch and " _
& "television here." & "There is an Atari Here"
itemsList.Items.Add("atari")
End If
End If
End Sub
End Class
and a seperate class module:
Option Strict Off
Option Explicit On
Friend Class room
Public desc As String
End Class
Friend Class people
End Class
Friend Class items
Public itemExist As Boolean
Public itemHave As Boolean
Public itemDesc As String
End Class
"Brian" <br***********@yahoo.com> schriebHi!
I am new to VB.net but know enough to kind of dive in. I want to make
a text adventure but I am having problems in how I want to store the
data for inventory items, characters and such. Right now, I have
three rooms but a lot of if and then statements on how to tell if
they should appear in your (listboxes) inventory or items in room
box.
Any suggestions on where to store this information? Here is a sample
of my code:
[code]
Could you please post the code again? Copy it to notepad first, then from
notepad to the posting. This keeps identation and does not insert blank
lines. It''s much easier for us to read.
--
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Public Class Form1
Inherits System.Windows.Forms.Form
Dim lecroneLivingRoom As New room()
Dim lecroneKitchen As New room()
Dim lecroneDen As New room()
Dim wigwam As New items()
Dim television As New items()
Dim atari As New items()
Dim locale As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
''This call is required by the Windows Form Designer.
InitializeComponent()
''Add any initialization after the InitializeComponent() call
End Sub
''Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
''Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
''NOTE: The following procedure is required by the Windows Form Designer
''It can be modified using the Windows Form Designer.
''Do not modify it using the code editor.
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents mainLbl As System.Windows.Forms.Label
Friend WithEvents itemsList As System.Windows.Forms.ListBox
Friend WithEvents inventoryList As System.Windows.Forms.ListBox
Friend WithEvents lookBtn As System.Windows.Forms.Button
Friend WithEvents dropBtn As System.Windows.Forms.Button
Friend WithEvents talkBtn As System.Windows.Forms.Button
Friend WithEvents useBtn As System.Windows.Forms.Button
Friend WithEvents getBtn As System.Windows.Forms.Button
Friend WithEvents northBtn As System.Windows.Forms.Button
Friend WithEvents westBtn As System.Windows.Forms.Button
Friend WithEvents southBtn As System.Windows.Forms.Button
Friend WithEvents eastBtn As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.mainLbl = New System.Windows.Forms.Label()
Me.inventoryList = New System.Windows.Forms.ListBox()
Me.itemsList = New System.Windows.Forms.ListBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.northBtn = New System.Windows.Forms.Button()
Me.westBtn = New System.Windows.Forms.Button()
Me.southBtn = New System.Windows.Forms.Button()
Me.eastBtn = New System.Windows.Forms.Button()
Me.talkBtn = New System.Windows.Forms.Button()
Me.useBtn = New System.Windows.Forms.Button()
Me.lookBtn = New System.Windows.Forms.Button()
Me.dropBtn = New System.Windows.Forms.Button()
Me.getBtn = New System.Windows.Forms.Button()
Me.SuspendLayout()
''
''mainLbl
''
Me.mainLbl.Location = New System.Drawing.Point(8, 8)
Me.mainLbl.Name = "mainLbl"
Me.mainLbl.Size = New System.Drawing.Size(448, 136)
Me.mainLbl.TabIndex = 0
''
''inventoryList
''
Me.inventoryList.Location = New System.Drawing.Point(480, 32)
Me.inventoryList.Name = "inventoryList"
Me.inventoryList.Size = New System.Drawing.Size(128, 121)
Me.inventoryList.TabIndex = 1
''
''itemsList
''
Me.itemsList.Location = New System.Drawing.Point(480, 200)
Me.itemsList.Name = "itemsList"
Me.itemsList.Size = New System.Drawing.Size(128, 121)
Me.itemsList.TabIndex = 2
''
''Label2
''
Me.Label2.Location = New System.Drawing.Point(480, 8)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(128, 16)
Me.Label2.TabIndex = 3
Me.Label2.Text = "Inventory"
''
''Label3
''
Me.Label3.Location = New System.Drawing.Point(480, 160)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(128, 24)
Me.Label3.TabIndex = 4
Me.Label3.Text = "Objects / Persons in Room"
''
''northBtn
''
Me.northBtn.Location = New System.Drawing.Point(208, 176)
Me.northBtn.Name = "northBtn"
Me.northBtn.TabIndex = 5
Me.northBtn.Text = "North"
''
''westBtn
''
Me.westBtn.Location = New System.Drawing.Point(136, 200)
Me.westBtn.Name = "westBtn"
Me.westBtn.TabIndex = 6
Me.westBtn.Text = "West"
''
''southBtn
''
Me.southBtn.Location = New System.Drawing.Point(208, 224)
Me.southBtn.Name = "southBtn"
Me.southBtn.TabIndex = 7
Me.southBtn.Text = "South"
''
''eastBtn
''
Me.eastBtn.Location = New System.Drawing.Point(280, 200)
Me.eastBtn.Name = "eastBtn"
Me.eastBtn.TabIndex = 8
Me.eastBtn.Text = "East"
''
''talkBtn
''
Me.talkBtn.Location = New System.Drawing.Point(176, 288)
Me.talkBtn.Name = "talkBtn"
Me.talkBtn.TabIndex = 9
Me.talkBtn.Text = "Talk"
''
''useBtn
''
Me.useBtn.Location = New System.Drawing.Point(88, 288)
Me.useBtn.Name = "useBtn"
Me.useBtn.TabIndex = 10
Me.useBtn.Text = "Use"
''
''lookBtn
''
Me.lookBtn.Location = New System.Drawing.Point(0, 288)
Me.lookBtn.Name = "lookBtn"
Me.lookBtn.TabIndex = 11
Me.lookBtn.Text = "Look"
''
''dropBtn
''
Me.dropBtn.Location = New System.Drawing.Point(352, 288)
Me.dropBtn.Name = "dropBtn"
Me.dropBtn.TabIndex = 12
Me.dropBtn.Text = "Drop"
''
''getBtn
''
Me.getBtn.Location = New System.Drawing.Point(264, 288)
Me.getBtn.Name = "getBtn"
Me.getBtn.TabIndex = 14
Me.getBtn.Text = "Get"
''
''Form1
''
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(616, 374)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.getBtn,
Me.dropBtn, Me.lookBtn, Me.useBtn, Me.talkBtn, Me.eastBtn, Me.southBtn,
Me.westBtn, Me.northBtn, Me.Label3, Me.Label2, Me.itemsList,
Me.inventoryList, Me.mainLbl})
Me.Name = "Form1"
Me.Text = "Gravel Ridge Adventure 0.0"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub westBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles westBtn.Click
REM living room to Kitchen
If locale = "lecroneLivingRoom" Then
locale = "lecroneKitchen"
itemsList.Items.Remove("wigwam")
lecroneKitchen.desc = "You are in the Lecrone Kitchen"
mainLbl.Text = lecroneKitchen.desc & _
"There is a Bobo light hanging from the ceiling with a " _
& "wicker light fixture. It is moving back and forth as " _
& "if someone has recently ghunked it. The living room " _
& "is to the East"
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles useBtn.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
mainLbl.Text = "Welcome To Gravel Ridge Adventure"
lecroneLivingRoom.desc = "This is the Lecrone Living Room"
locale = "lecroneLivingRoom"
mainLbl.Text = mainLbl.Text & lecroneLivingRoom.desc
wigwam.itemExist = True
If wigwam.itemExist = True Then
mainLbl.Text = mainLbl.Text & "There is a Wigwam here."
itemsList.Items.Add("wigwam")
End If
End Sub
Private Sub itemsList_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
itemsList.SelectedIndexChanged
End Sub
Private Sub inventoryList_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
inventoryList.SelectedIndexChanged
End Sub
Private Sub lookBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lookBtn.Click
If itemsList.SelectedItem = "wigwam" Then
mainLbl.Text = mainLbl.Text & "This is a superhero jacket"
End If
End Sub
Private Sub dropBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles dropBtn.Click
End Sub
Private Sub getBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles getBtn.Click
REM Getting WigWam
If locale = "lecroneLivingRoom" And wigwam.itemExist = True Then
If itemsList.SelectedItem = "wigwam" Then
inventoryList.Items.Add("wigwam")
itemsList.Items.Remove("wigwam")
wigwam.itemExist = False
wigwam.itemHave = True
End If
End If
REM Getting Atari
If locale = "lecroneDen" And atari.itemExist = True Then
If itemsList.SelectedItem = "atari" Then
inventoryList.Items.Add("atari")
itemsList.Items.Remove("atari")
atari.itemExist = False
atari.itemHave = True
End If
End If
End Sub
Private Sub northBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles northBtn.Click
REM Den to Living Room
If locale = "lecroneDen" Then
locale = "lecroneLivingRoom"
itemsList.Items.Remove("atari")
End If
If wigwam.itemHave = True Then
mainLbl.Text = lecroneLivingRoom.desc
Else
mainLbl.Text = lecroneLivingRoom.desc & "There is a Wigwam
here."
itemsList.Items.Add("wigwam")
End If
End Sub
Private Sub eastBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles eastBtn.Click
REM Kitchen to Living Room
If locale = "lecroneKitchen" Then
locale = "lecroneLivingRoom"
End If
REM Living Room To EAST
If locale = "lecroneLivingRoom" Then
mainLbl.Text = "You Can''t Go That Way"
End If
If wigwam.itemHave = True Then
itemsList.Items.Clear()
Else
mainLbl.Text = mainLbl.Text & "There is a Wigwam here."
itemsList.Items.Add("wigwam")
End If
End Sub
Private Sub southBtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles southBtn.Click
If locale = "lecroneLivingRoom" Then
locale = "lecroneDen"
itemsList.Items.Remove("wigwam")
lecroneDen.desc = "You are in the Lecrone Den."
mainLbl.Text = lecroneDen.desc & "This room could have " _
& "been a garage at one time. There is a couch and " _
& "television here."
atari.itemExist = True
If atari.itemExist = True Then
mainLbl.Text = lecroneDen.desc & "This room could have " _
& "been a garage at one time. There is a couch and " _
& "television here." & "There is an Atari Here"
itemsList.Items.Add("atari")
End If
End If
End Sub
End Class
Option Strict Off
Option Explicit On
Friend Class room
Public desc As String
End Class
Friend Class people
End Class
Friend Class items
Public itemExist As Boolean
Public itemHave As Boolean
Public itemDesc As String
End Class
"Armin Zingler" <az*******@freenet.de> wrote in message
news:OW**************@TK2MSFTNGP09.phx.gbl..."Brian" <br***********@yahoo.com> schriebHi!
I am new to VB.net but know enough to kind of dive in. I want to make
a text adventure but I am having problems in how I want to store the
data for inventory items, characters and such. Right now, I have
three rooms but a lot of if and then statements on how to tell if
they should appear in your (listboxes) inventory or items in room
box.
Any suggestions on where to store this information? Here is a sample
of my code:
[code]
Could you please post the code again? Copy it to notepad first, then from
notepad to the posting. This keeps identation and does not insert blank
lines. It''s much easier for us to read.
--
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Hi Brian,
As far as I understand what you want, I think I would use a XML dataset in
this case.
I asume it is a standalone application.
Cor
这篇关于关于数据类型的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!