Friday, 14 June 2013

How to make a pop up window in vb.net

HI user you can make popup window by writing that piece of code
here FrmProviderMedicationsis name of form which you open as pop window

 Dim obj As New FrmProviderMedications()
                obj.ShowDialog()

Regards:
Ahmad Khalid
Software Engineer

Convert String rgb to color IN VB.NET

Hi user  i solve that problem by using that piece of code .here NOTE_STATUS_COLOUR is string in which color is save i convert into color in this way.and put in background of row color in ultragrid

If e.Row.Cells("NOTE_STATUS_COLOUR").Value IsNot Nothing Then
  Dim noteColor As Color =System.Drawing.Color.FromName(CStr(e.Row.Cells("NOTE_STATUS_COLOUR").Value).Trim)
            e.Row.Appearance.BackColor = noteColor
            e.Row.Appearance.BackColor2 = noteColor
        End If


Thursday, 13 June 2013

disable(readonly) all control of a form(window) from other window in vb.net

Hi  i  made all control except close button disable all read only in this way. my all control in the panel and i disable all that and also made disable all toolbar control


Private Sub FrmTodoList_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

  If IsReadOnly Then
            DisableAll()
        End If
    End Sub

 Private Sub DisableAll()
        Me.PnlCSDetail.Enabled = False
        For Each tool As Infragistics.Win.UltraWinToolbars.ToolBase In Me.TBMCSDetail.Toolbars(0).Tools
            If Not tool.Key.ToLower.Equals("dclose") Then
                tool.SharedProps.Visible = False
                tool.SharedProps.Enabled = False
            End If
        Next

 Public Property IsReadOnly() As Boolean
        Get
            Return _isReadOnly
        End Get
        Set(ByVal value As Boolean)
            _isReadOnly = value
        End Set
    End Property
Regards:
Ahmad Khalid
Software Engineer

Wednesday, 12 June 2013

Prevent From Duplicate Record editing in Ultragrid

I Resolve this Problem By using That Type of Check

  Dim frmdrug As New frmDrugSearch
                If Cbxprovider.Text = Nothing Then
                    MessageBox.Show("Please Select the Provider First.........")
                Else
                    Dim rw As UltraGridRow = Cbxprovider.SelectedRow()

                    If frmdrug.ShowDialog(ListFormOpenMode.SelectionOnly) = Windows.Forms.DialogResult.OK Then
                        If dsView.Tables(0).Select("DRUG_NDC = '" + frmdrug.DRUG_NDC + "' AND PROVIDER_ID = " + selectedProvider + " ").Length = 0 Then
                            Dim newRow As DataRow = dsView.Tables(0).NewRow
                            newRow("DRUG_ID") = frmdrug.MEDICATION_ID
                            newRow("DRUG_NDC") = frmdrug.DRUG_NDC
                            newRow("DRUG_NAME") = frmdrug.BRAND_NAME
                            newRow("ACTIVE") = True
                            newRow("PROVIDER_ID") = selectedProvider
                            dsView.Tables(0).Rows.Add(newRow)
                        Else
                            MessageBox.Show("Selected Grug Already Exists", "Add")
                        End If

                    End If