列表框相互交互时遇到问题! [英] Having problems with listboxes interacting with each other!

查看:56
本文介绍了列表框相互交互时遇到问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我刚刚开始使用Visual Basic(大约3个月了),但似乎遇到了麻烦.
我需要做的项目是制作飞机座位表"程序.
到目前为止,这是我的程序的外观(按设计):

http://i47.tinypic.com/jgs8rn.jpg

标准是:一架飞机有15行(编号1至15),每行有6个座位(分别标记为A,B,C,D,E和F).编写一个程序以在列表中显示座位表售票员单击列表框中的所需行时,行号和该席位的状态将显示在七个只读文本框中.在文本框中,出现第二个窗体,其中包含四个标记为空置",常规",低热量"和素食"的选项按钮,单击任意单选按钮将关闭第二个窗体,并同时更新文本框和该列表框中该座位的行.空座位应标有句号,空座位应标明其用餐类型的首字母,代理商可以随时要求提供空位,空位和每种类型的座位数.点餐."所以最后应该看起来像这样:

http://i45.tinypic.com/jl457b.jpg

到目前为止,我的代码是:

Hello, I''ve just started working with Visual Basic (roughly 3 months now) and I''ve seem to hit a snag.
The project at hand that I need to do is to make a Airplane Seating Chart program.
This is what my program looks like so far (design-wise):

http://i47.tinypic.com/jgs8rn.jpg

The criteria is: "An airplane has 15 rows (numbered 1 through 15), with six seats (labeled A, B, C, D, E, and F) in each row. Write a program to display the seating chart in a list box with a line for each row. When the ticket agent clicks on the desired row in the list box, the row number and the status of the seats in the row are displayed in seven read-only text boxes. When the agent clicks on one of the text boxes, a second form containing four option buttons labeled Unoccupied, Regular, Low Calorie, and Vegetarian appears. Clicking on any radio button closes the second form and updates both the text box and the row for that seat in the list box. Unoccupied seats should be denoted with a period, while occupied seats are denoted with the first letter of their meal type. At any time, the agent can request the number of seats filled, the number of window seats vacant, and the numbers of each type of meal ordered." So in the end, it should look like this:

http://i45.tinypic.com/jl457b.jpg

So far, my code is:

Public Class Form1
Dim meal As String
Dim rows(14, 5) As String
Dim seat1 As String, seat2 As String, seat3 As String, seat4 As String, seat5 As String, seat6 As
String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Dim column As String
seatSets.Items.Clear()
column = seatSets.Items.Add(" A B C D E F")
For rows As Integer = 0 To 14
seatSets.Items.Add(" . . . . . .")
Next
seatA.Items.Add(" . ")
seatB.Items.Add(" . ")
seatC.Items.Add(" . ")
seatD.Items.Add(" . ")
seatE.Items.Add(" . ")
seatF.Items.Add(" . ")
End Sub
Private Sub seatSets_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles seatSets.SelectedIndexChanged
Dim rowSelect As String
End Sub
Private Sub rowNum_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rowNum.SelectedIndexChanged
End Sub
Private Sub seatA_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles seatA.SelectedIndexChanged
End Sub
Private Sub seatB_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles seatB.SelectedIndexChanged
End Sub



我似乎无法弄清楚的问题是,我应该如何获取座位表(seatSet),以便与各个座位列表框(即seatA,seatB等)进行交互.那,以及如何使最终图片中的"frmMeal"与之交互.非常感谢您提供任何帮助,因为我在LCD上注视我的眼睛,试图找出答案! :omg:期待所有答复---谢谢! :)



The problem that I can''t seem to figure out is how I''m suppose to get seating chart (seatSets) to interact with the individual seat listboxes (ie. seatA, seatB and so on). That, and how to get the "frmMeal" in the final picture to interact with it all. ANY help would be greatly appreciated, as I''m bleeding my eyes out on the LCD, trying to figure this out! :omg: Looking forward to any and all replies---thanks! :)

推荐答案

notso-slickrick写道:
notso-slickrick wrote:

我可以解决的问题"似乎并没有弄清楚我是如何获得座位表(seatSets)以与各个座位列表框(即seatA,seatB等)进行交互的.

The problem that I can''t seem to figure out is how I''m suppose to get seating chart (seatSets) to interact with the individual seat listboxes (ie. seatA, seatB and so on).



我想您会遍历集合以设置需要设置的数据. seatA-seatF需要存在于集合中,它们存在15次.因此,我认为您的设计部分已损坏.



I''d imagine you''d iterate over the collection to set up your data as it needs to be set. seatA-seatF needs to exist in a collection, they exist 15 times. So, I think that part of your design is broken.

notso-slickrick写道:
notso-slickrick wrote:

那,以及如何在最终图片中获取"frmMeal"以与之交互.

That, and how to get the "frmMeal" in the final picture to interact with it all.



如果弹出该窗体,然后将其关闭(是模式的),则可以将数据传递给它,并在关闭时从中拉出数据.否则,您可以使用委托在表单之间进行通信,



If the form pops up, and then is closed ( is modal ), you can just pass data to it, and pull data from it as it closes. Otherwise, you can use delegates to communicate between forms,


这篇关于列表框相互交互时遇到问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆