Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2010  |  syntax: VB.NET  |  size: 0.86 KB  |  hits: 125  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Imports System.IO
  2.  
  3. Public Class _Default
  4.     Inherits System.Web.UI.Page
  5.  
  6.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  7.         Dim test As String = String.Empty
  8.         If IsPostBack Then
  9.             test = "PostBack"
  10.         Else
  11.             test = "not a post back event"
  12.         End If
  13.     End Sub
  14.  
  15.     Protected Sub btnDoSomething_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDoSomething.Click
  16.         Dim output As String = String.Empty
  17.         For Each li As ListItem In CheckBoxList1.Items
  18.             If (li.Selected) Then
  19.                 If (output.Trim = String.Empty) Then
  20.                     output = li.Text
  21.                 Else
  22.                     output = String.Format("{0} {1}", output, li.Text)
  23.                 End If
  24.             End If
  25.         Next
  26.     End Sub
  27. End Class