应用程序启动时检查的CheckListBox项目 [英] CheckListBox items checked when application start

查看:153
本文介绍了应用程序启动时检查的CheckListBox项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个代码,我的代码有错误



i need a code my code is bugy



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       'check first1 on load
        Dim selectedIndex1 As Integer = CheckedListBox1.SelectedIndex
        selectedIndex1 = 1
        CheckedListBox1.SetItemChecked(selectedIndex1, True)

        ';check first2 on load
        Dim selectedIndex2 As Integer = CheckedListBox2.SelectedIndex
        selectedIndex2 = 1
        CheckedListBox2.SetItemChecked(selectedIndex2, True)
    End Sub





下来我有





and down i have

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      


        Dim itemChecked As String

        itemChecked = CheckedListBox1.SelectedItem





        Dim itemChecked2 As String
        itemChecked2 = CheckedListBox2.SelectedItem



        If (CheckedListBox1.SelectedItem <> "") Then
            Dim casuche1 As Object
            For Each casuche1 In CheckedListBox1.CheckedItems
            Next
        Else
            MessageBox.Show("You must select RAM allocated in first form")
            Exit Sub
        End If
        If (CheckedListBox2.SelectedItem <> "") Then
            Dim casuche2 As Object
            For Each casuche2 In CheckedListBox2.CheckedItems
            Next
        Else
            MessageBox.Show("You must select RAM allocated in second form")
            Exit Sub
        End If



        End
    End Sub

   Private Sub CheckedListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckedListBox2.SelectedIndexChanged

        If CheckedListBox2.CheckedItems.Count > 1 Then
            For Each itemChecked2 In CheckedListBox2.CheckedIndices
                CheckedListBox2.SetItemChecked(itemChecked2, False)
            Next
        End If
End Sub

推荐答案

请帮我吗?!
WTF没有人知道我该怎么做?
help me please ?!
WTF nobody wknow how i can make this ?


我使用应用程序内存来​​记住我检查过的项目
I use the application memory to remember what items i checked


这篇关于应用程序启动时检查的CheckListBox项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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