如何通过单击特定列表框项打开表单 [英] how to open a form by clicking particuler listbox item

查看:84
本文介绍了如何通过单击特定列表框项打开表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我现在正在显示一些图片作为项目请告诉我如何根据列表框中点击的项目打开特定表单。



谢谢

解决方案

查看此链接。

http://stackoverflow.com/问题/ 4548706 / mvvm-how-do-a-open-a-based-on-a-selected-item-from-a-list [ ^ ]


这也可以很简单。



你可以使用If Else或Switch case方法..

您可以进行按钮点击活动...





放置一个Listbox1和Button1控件Form1.vb [设计]

并在Form1.vb中键入以下代码






 私人  Sub  Button1_Click( ByVal  sender  As  System。对象 ByVal  e  As  System.EventArgs)句柄 Button1.Click 
如果(ListBox1.SelectedIndex = 0 然后
Form2.Show()
ElseIf (ListBox1 .SelectedIndex = 1 然后
Form3.Show()
结束 如果
结束


Hi all

I am showing some images as items now please tell me how to open particular form based on the item clicked in that list box.

Thank you

解决方案

check this link.
http://stackoverflow.com/questions/4548706/mvvm-how-do-i-open-a-window-based-on-a-selected-item-from-a-list[^]


This can also be done simple.

You can use either If Else or Switch case method..
You can do on "button click" event...


Place a Listbox1 and Button1 controls on Form1.vb[Design]
and type the following code in Form1.vb



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If (ListBox1.SelectedIndex = 0) Then
            Form2.Show()
        ElseIf (ListBox1.SelectedIndex = 1) Then
            Form3.Show()
        End If
    End Sub


这篇关于如何通过单击特定列表框项打开表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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