VB如果在ListBox1中选择了邮政编码,则$ 15或ListBox2费用为$ 20(如果两个ListBox中都不包含邮政编码)该应用程序应显示消息 [英] VB if zip code is chose in ListBox1 then $15 or ListBox2 charge is $20 if zip code is not included in either ListBox The app should display message

查看:94
本文介绍了VB如果在ListBox1中选择了邮政编码,则$ 15或ListBox2费用为$ 20(如果两个ListBox中都不包含邮政编码)该应用程序应显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


'Project name:             Ship With Us Project
'Project Purpose:          Allows the user to put in a Zip code in the first ListBox to = $15 or $20 ,
'                          for second to get the Shipping charge.
'Created/revised by:        4/15/2011
Option Explicit On
Option Strict On
Option Infer Off
Public Class Main
    Private _listBox15ship As Boolean

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
        'fills the list box with zip codes
        ListBox1.Items.Add("60611")
        ListBox1.Items.Add("60234")
        ListBox1.Items.Add("56789")
        ListBox1.Items.Add("23467")
        ListBox1.Items.Add("60543")
        ListBox1.Items.Add("60561")
        ListBox1.Items.Add("55905")
        ListBox1.Items.Add("89567")
        'fills the list box with second set of zip codes
        ListBox2.Items.Add("50978")
        ListBox2.Items.Add("78432")
        ListBox2.Items.Add("98432")
        ListBox2.Items.Add("97654")
        ListBox2.Items.Add("20245")
    End Sub
    Private Sub ShippingButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShippingButton.Click
        'determine whether a list box contains a specific zip code
        Dim isDisplayed As Boolean
        Dim index As Integer
        Dim numberOfItems As Integer
        Dim id As String = String.Empty
        'if the user picks a zip code in ListBox1 then the shipping charge is $15.00
        'and if zip code is chose in  ListBox2  shipping charge is $20.00

        If (ListBox1.FindString(ListBox.Text >= 0)) Then
            shippinglbl.Show("shipping is $15")
        ElseIf (ListBox2.FindString(ListBox.Text >= 0)) Then
            shippinglbl.Show("Shipping is $20")
        Else
            shippinglbl.Show("The zipcode was not found!")
        End If

    End Sub

推荐答案

15或


20, ' 收取运费. ' 创建/修订日期:2011年4月15日 选项 显式 打开 选项 严格 打开 选项推断关闭 公共 主要 私有 _listBox15ship As 布尔值 私有 Sub MainForm_Load( ByVal 发​​件人 As 系统.对象 ByVal e As System.EventArgs)句柄 Me .Load ' 用邮政编码填充列表框 ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ListBox1.Items.Add(" ) ' 在列表框中填充第二组邮政编码 ListBox2.Items.Add(" ) ListBox2.Items.Add(" ) ListBox2.Items.Add(" ) ListBox2.Items.Add(" ) ListBox2.Items.Add(" ) 结束 私有 ShippingButton_Click( ByVal 发​​件人目标 对象 ByVal e As System.EventArgs)' 确定列表框是否包含特定的邮政编码 显示 Dim As 布尔值 Dim 索引 As 整数 Dim numberOfItems As 整数 Dim id As 字符串 = 字符串.空 ' 如果用户在ListBox1中选择了邮政编码,则运费为
20 , ' for second to get the Shipping charge. 'Created/revised by: 4/15/2011 Option Explicit On Option Strict On Option Infer Off Public Class Main Private _listBox15ship As Boolean Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load 'fills the list box with zip codes ListBox1.Items.Add("60611") ListBox1.Items.Add("60234") ListBox1.Items.Add("56789") ListBox1.Items.Add("23467") ListBox1.Items.Add("60543") ListBox1.Items.Add("60561") ListBox1.Items.Add("55905") ListBox1.Items.Add("89567") 'fills the list box with second set of zip codes ListBox2.Items.Add("50978") ListBox2.Items.Add("78432") ListBox2.Items.Add("98432") ListBox2.Items.Add("97654") ListBox2.Items.Add("20245") End Sub Private Sub ShippingButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShippingButton.Click 'determine whether a list box contains a specific zip code Dim isDisplayed As Boolean Dim index As Integer Dim numberOfItems As Integer Dim id As String = String.Empty 'if the user picks a zip code in ListBox1 then the shipping charge is


15.00 ' ,如果在ListBox2中选择了邮政编码,则运费为
15.00 'and if zip code is chose in ListBox2 shipping charge is


这篇关于VB如果在ListBox1中选择了邮政编码,则$ 15或ListBox2费用为$ 20(如果两个ListBox中都不包含邮政编码)该应用程序应显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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