Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim strConnection As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
- Dim con As SqlConnection = New SqlConnection(strConnection)
- Dim cmd As SqlCommand = New SqlCommand
- Dim objDs As DataSet = New DataSet
- Dim dAdapter As SqlDataAdapter = New SqlDataAdapter
- cmd.Connection = con
- cmd.CommandType = CommandType.Text
- cmd.CommandText = "SELECT distinct FIELD FROM TABLE order by FIELD"
- dAdapter.SelectCommand = cmd
- con.Open()
- dAdapter.Fill(objDs)
- con.Close()
- If (objDs.Tables(0).Rows.Count > 0) Then
- lstDropdown.DataSource = objDs.Tables(0)
- lstDropdown.DataTextField = "FIELD"
- lstDropdown.DataValueField = "FIELD"
- lstDropdown.DataBind()
- lstDropdown.Items.Insert(0, "Please Select")
- lstDropdown2.Items.Insert(0, "Please Select")
- Else
- lblMessage.Text = "* Our Database seem to be down!"
- End If
- Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
- ?????????????????????????????????
- End Try
- End Sub
- Public Class Person
- private _firstName as string
- private _lastName as string
- '''Constructor with no params
- public Sub New()
- _firstName = ""
- _lastName = ""
- End Sub
- 'Contructor with params
- Public Sub New(FirstName as String, LastName as String)
- _firstName = FirstName
- _lastName = LastName
- End Sub
- Public Property FirstName As String
- Get
- return _firstName
- End Get
- Set(value as String)
- _firstName = value
- End Set
- End Property
- Public Property LastName As String
- Get
- return _lastName
- End Get
- Set(value as String)
- _lastName = value
- End Set
- End Property
- Public Function HitHomeRun() As Boolean
- ....'Do some stuff here
- End Function
- End Class
- Dim p as New Person()
- p.FirstName = "Mike"
- p.LastName = "Schmidt"
- dim IsHomeRunHit As Boolean = p.HitHomeRun()
- Public Shared Sub PopulateDropdowns(lstDropdown As DropDownList, lstDropdown2 As DropDownList)
- ... here goes your code
- End Sub
- UIHelper.PopulateDropdowns(lstDropdown, lstDropdown2)
- Public Class Common
- Public Shared Sub MyMethod
- 'Do things.
- End Sub
- End Class
- Common.MyMethod
Add Comment
Please, Sign In to add comment