h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

State Pattern in VB.net

Today we will discuss about the State Pattern in Vb.net.
Description:
    State pattern allows an object to change its behavior depending on the current values of the object. Consider the figure 'State pattern example'. It's an example of a

Box Status operation. If the state of the Box Status is off and you press the switch the BoxStatus will turn off. If the state of BoxStatus is on and you press the switch the Box Status will be off. So

in short depending on the state the behavior changes.
Create a Class file in the Vb.net Project


Enum BoxStatus
      BoxOn = 1
      BoxOff = 2
  End Enum
Public Shared defaultBoxstatus As BoxStatus = BoxStatus.BoxOff
Public Function displayMessage() As String
        If BoxStatus.BoxOn = defaultBoxstatus Then
            Return "Box is on"
        Else
            Return "Box is off"
        End If
End Function
Public Sub Pressswitch()
        If defaultBoxstatus = BoxStatus.BoxOn Then
            defaultBoxstatus = BoxStatus.BoxOff
        Else
            defaultBoxstatus = BoxStatus.BoxOn
End If
End Sub
Dim Clas As New Class1()
  Clas.Pressswitch()
  MessageBox.Show(Clas.displayMessage()) 

Display Crystal Report title -- Programmatically in VB.net

Today , we will see the Display Crystal Report title -- Programmatically in VB.net
Here is a Code:
Create a Text Object in the Design View.
Call this code in the Crystal report viewer Load event.  

Dim cry As CrystalReport1 = New CrystalReport1()
Dim txtHeader As CrystalDecisions.CrystalReports.Engine.TextObject = cry.Section1.ReportObjects("txtHeader") Dim txtAddress1 As CrystalDecisions.CrystalReports.Engine.TextObject = cry.Section1.ReportObjects("txtAddress1") Dim txtAddress2 As CrystalDecisions.CrystalReports.Engine.TextObject = cry.Section1.ReportObjects("txtAddress2") Dim txtAddress3 As CrystalDecisions.CrystalReports.Engine.TextObject = cry.Section1.ReportObjects("txtAddress3") txtHeader.Text = "IBM" txtAddress1.Text = "OMR Road" txtAddress2.Text = "Chennai" Me.CrystalReportViewer1.ReportSource = cry

Query for getting Table name from database

Today , we will discuss about getting Table name from Database
select table_name from INFORMATION_SCHEMA.tables where Table_Type='BASE TABLE'