Robert McLaws: FunWithCoding.NET

Public Shared Function BrainDump(ByVal dotNet As String) As [Value]

News

<script type="text/javascript"><!-- google_ad_client = "pub-4330602465258980"; google_hints = "ASP.NET, VB.NET, C#, C#.NET, WindowsForms, .NET Framework, VS2005, Visual Studio, XAML, WinFX, Windows Workflow, WPF, WCF, Atlas, NetFX3, Visual Studio Orcas"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel ="4997399242"; google_color_border = "B6C9E7"; google_color_bg = "EFEFEF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "002C99"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<!--
-->

You should feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever. That said, I will most likely only delete abusive, profane, rude, or annonymous comments, so keep it polite, please.

Blogroll

Cool .NET Articles

My .NET Tools

My Builder.com Articles

My MSKB Articles

VisualBlogger CategoryPost Test #9

The WinForms adventure continues. The CheckedListBox control has been giving me all sorts of problems. For one thing, if you put one in a TabControlPage, and then switch pages, it doesn't hold its state. It took me a little bit of experimentation, but I came up with the following code to help out:

1    Dim chk1 As New ArrayList

2 Dim chk2 As New ArrayList
3
4#Region " OptionsTabPage.Leave Event Handler "

5
6 Private Sub OptionsTabPage_Leave(ByVal sender As Object, ByVal e As System.EventArgs)
Handles OptionsTabPage.Leave
7 chk1.Clear()
8 chk2.Clear()
9 Dim tmpChk1 As CheckedListBox.CheckedIndexCollection = BlogList.CheckedIndices
10 For y As Integer = 0 To tmpChk1.Count - 1
11 chk1.Add(tmpChk1.Item(y))
12 Next
13 Dim tmpChk2 As CheckedListBox.CheckedIndexCollection = CategoryList.CheckedIndices
14 For z As Integer = 0 To tmpChk2.Count - 1
15 chk2.Add(tmpChk2.Item(z))
16 Next
17 End Sub
18#End Region
19
20#Region " Tab Control Page Changed Event "

21
22 Private Sub ViewTabControl_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles ViewTabControl.SelectedIndexChanged
23 Dim currentPage As TabControl = CType(sender, TabControl)
24 Select Case currentPage.SelectedTab.Name
25 Case "OptionsTabPage"
26 Try
27 For y As Integer = 0 To chk1.Count - 1
28 BlogList.SetItemChecked(chk1(y).ToString, True)
29 Next
30 Catch
31 End Try
32 Try
33 For z As Integer = 0 To chk2.Count - 1
34 CategoryList.SetItemChecked(chk2(z).ToString, True)
35 Next
36 Catch
37 End Try
38 End Select
39 End Sub
40#End Region
At any rate, this port is a test of the "PostToCategories" functionality. Now that I'm saving the state properly, and using the "CheckedIndices" property instead of "SelectedIndices" property, it should work. I'll know in about 8 seconds.

Comments

TrackBack said:

# March 29, 2004 6:24 AM