Wednesday, 21 August 2013

Remove the highlighting from combobox when selected

To remove the highlight from a selected item in a combo box:

ComboBox1.SelectedIndex = -1

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

Wednesday, 29 May 2013

ultra grid control helps and setting code

code for displaying delete conformation 


  Dim row As UltraGridRow

                If CSMsgBox.ShowQuestionMessage("Do you want to delete the data on the grid?", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then

                    For Each row In Me.UltraGrid1.Selected.Rows

                        row.Delete(False)

                        Me.UltraGrid1.UpdateData()
                    Next
                End If

code for displaying checkbox and text after check box click in ultra grid

 Dim chk As New Infragistics.Win.UltraWinEditors.UltraCheckEditor

 Me.UltraGrid1.DisplayLayout.Bands(0).Columns("ACTIVE").Style = ColumnStyle.CheckBox
        Me.UltraGrid1.DisplayLayout.Bands(0).Columns("ACTIVE").Editor = chk.EditorUltraGrid1.DisplayLayout.Bands(0).Override.CellDisplayStyle = CellDisplayStyle.FormattedText

Ultra Grid: Remove/Change selected Row color


If you want to remove selected row color(by default blue) and preserve your cell colors, follow this procedure.

Private Sub grid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultragrid.InitializeLayout

'Make selected row color to transparant
e.Layout.SelectionOverlayColor = SystemColors.Highlight
'remove slected and active appearance
With e.Layout.Bands(0)
.Override.SelectedAppearancesEnabled = DefaultableBoolean.False
.Override.ActiveAppearancesEnabled = DefaultableBoolean.False
End With

End Sub

code for Auto_fitting columns to ultraGrid's width
first of all import this

Imports Infragistics.Win.UltraWinGrid
Then
Me.UltraGrid1.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns

code for Ultra Grid to select an entire row when a cell is clicked

UltraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect
code for Ultra Grid, how to lock cell data - disable editing
' Disable updating on the entire grid
Me.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False



' Enable updating on the root band. This will override the DisplayLayout setting
Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowUpdate = DefaultableBoolean.False



Code for Multi selection off
 e.Layout.Override.SelectedAppearancesEnabled = DefaultableBoolean.False

If u want on then simply write true in place of false on above line

Code for ADD New Row
if you want at row on buttom then do this
UltraGrid.displaylayout.Override.AllowAddNew=AllowAddNew.FixedAddRowOnBottom

if you want at row on top then do this
UltraGrid.displaylayout.Override.AllowAddNew=AllowAddNew.FixedAddRowOnTop

and so on many properties please explore it

Code for Row Selector
Me.UltraGrid.displaylayout.Bands(0).Override.RowSelectors=DefaultableBoolean.True


Code for delete row from database

Me.UltraGrid.ActiveRow.Delete()

Code for Color the specific column
 in ultragrid InitializeRow event
  e.Row.Cells("cell name here").Appearance.BackColor = Color.Green


Code for Hide row selectors:

in ultragrid InitializeLayout event
e.Layout.Override.RowSelectors = DefaultableBoolean.False

Code for Column Sorting Disable

in ultra grid Initialize Layout event

e.layout.Override.HeaderClickAction = HeaderClickAction.Select
e.layout.Override.SelectTypeCol = SelectType.None


Hide group header box:
In ultra grid grid Initialize Layout

e.Layout.GroupByBox.Hidden = True

code for Hide row selectors:
In ultragridgrid InitializeLayout event

e.Layout.Override.RowSelectors = DefaultableBoolean.False

three properties of the override that control ' on the Override off the DisplayLayout, then these settings apply to the whole ' UltraGrid.

'FOR MODIFY ALLOW OR UPDATE IN ULTRAGRID
Me.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True

'FOR adding and delecting in ultragrid

      Me.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No
      Me.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False

     ' You can set them on a specific band as well. These settings override those
      ' set on the DisplayLayout's Override object for this band.
   Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowUpdate = DefaultableBoolean.True
      Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowAddNew = AllowAddNew.No
      Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowDelete = DefaultableBoolean.False

 ' There are Activation properties on row, column and cells that dictate whether 
      ' associated cells can be modified, or can even enter in edit mode.
  Dim column As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns("CustomerID")
      Dim row As UltraGridRow = Me.ultraGrid1.Rows(0)

' Set the CellActivation off the column something other than AllowEdit to prevent
  ' the user from modifying cells in that column. ActivateOnly allows the user to 
  ' go into edit mode so the user can select and copy text, however the cell will
      ' be read-only thus preventing any data modification.
      column.CellActivation = Activation.ActivateOnly

      ' You can override cell activation setting for a particular row. 
      row.Activation = Activation.ActivateOnly

      ' Furthermore you can override activation on a cell as well.
      row.Cells(column).Activation = Activation.AllowEdit


 code for Selecting single row:
In ultragridgrid InitializeLayout event

e.Layout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single

code for made Fixed Columns
In ultragridgrid InitializeLayout event

e.Layout.UseFixedHeaders = true
UltraGrid.Bands[0].Columns[0].Header.Fixed = true
UltraGrid.Bands[0].Columns[1].Header.Fixed = true
                               OR
Me.UltraGrid.displaylayout.override.AllowCalSizing=AllowCalSizing.None

code for made Fixed Row
Me.UltraGrid.displaylayout.override.RowSizing=RowSizing.Fixed

Change cell button properties/appeacence
In ultragridgrid InitializeLayout event

e.Layout.Bands(0).Columns("name of cell write here").CellButtonAppearance

code for Disable Column Sorting
In ultragridgrid InitializeLayout event


e.Layout.Override.HeaderClickAction = HeaderClickAction.Select
e.Layout.Override.SelectTypeCol = SelectType.None

code to enable immediate scrolling

In ultragridgrid InitializeLayout event

e.Layout.ScrollBounds = ScrollBounds.ScrollToFill
e.Layout.ScrollStyle = ScrollStyle.Immediate


code  for Update datasource for each cell change
In ultragridgrid InitializeLayout event

UltraGrid1.UpdateMode = Infragistics.Win.UltraWinGrid.UpdateMode.OnCellChange

code if you want To change grid Header Appearance

In ultragridgrid InitializeLayout event

UltraGrid1.DisplayLayout.Bands(0).Override.HeaderAppearance property

code if you want To disable column swapping, moving,sizing and GroupBy
In ultragridgrid InitializeLayout event

With UltraGrid1.DisplayLayout.Bands(0).
.Override.AllowColMoving = AllowColMoving.NotAllowed
.Override.AllowColSwapping = AllowColSwapping.NotAllowed
.Override.AllowColSizing = AllowColSizing.None
.Override.AllowGroupBy = DefaultableBoolean.False


code for Show header text in multi line

In ultragridgrid InitializeLayout event


UltraGrid1.DisplayLayout.Bands(0).Override.WrapHeaderText = DefaultableBoolean.False
UltraGrid1.ColHeaderLines = 2 'two lines
UltraGrid1.Columns(0).Header.Caption = "here write text" & Environment.NewLine & "here write text"


code to select a full row if click on any cell
In ultragrid InitializeLayout event

UltraGrid1.DisplayLayout.Bands(0).Override.CellClickAction = CellClickAction.RowSelect

code for Hide a column
In ultragrid InitializeLayout event
UltraGrid1.DisplayLayout.Bands(0).Columns("here write column name").Hidden = True


code for Adding DropDownList column
In ultragrid InitializeLayout event


UltraGrid1.DisplayLayout.Bands(0).Columns("here write ColumnName").Style = ColumnStyle.DropDownList
UltraGrid1.DisplayLayout.Bands(0).Columns("here write ColumnName").ValueList = UltraGrid1.DisplayLayout.ValueLists("my list")

' now create ultragrid list
UltraGrid1.DisplayLayout.ValueLists.Add("my list")
UltraGrid1.DisplayLayout.ValueLists("my list ").ValueListItems

Dim list As New ValueListItem()

list.DataValue = 1
list.DisplayText = "car"
.Add(list)

list= New ValueListItem()
list.DataValue = 2
list.DisplayText = "bus"
.Add(list)

list= New ValueListItem()
list.DataValue = 3
list.DisplayText = "train"
.Add(list)


list= New ValueListItem()
list.DataValue = 4
list.DisplayText = "motor cycle"
.Add(list)



code for Adding a button column
In ultragrid InitializeLayout event

UltraGrid1.DisplayLayout.Bands(0).Columns(0).Style = ColumnStyle.Button
UltraGrid1.DisplayLayout.Bands(0).Columns(0).ButtonDisplayStyle = UltraWinGrid.ButtonDisplayStyle.Always


code for make cell text multi line
In ultragridgrid InitializeLayout event

UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellMultiLine = DefaultableBoolean.True


UltraGrid1.DisplayLayout.Bands(0).Columns(0).VertScrollBar = True

code for reset the sorted columns when unloading
ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear()

Do not show Expansion Indicator when there are no child items/band
In grid InitializeLayout event handler, set

UltraGrid1.DisplayLayout.Bands(0).Override.ExpansionIndicator=ShowExpansionIndicator.CheckOnDisplay
'code for increasing the default row height of the ultra grid

UltraGrid1.DisplayLayout.Override.DefaultRowHeight = 500

'code for change column header text
In ultragrid InitializeLayout event

UltraGrid1.DisplayLayout.Bands(0).Columns(0).Header.Caption = "My header"

code for change date column format
In ultragrid InitializeLayout event

UltraGrid1.DisplayLayout.Bands(0).Columns(0).Format = "dd/mm/yyyy hh:mm:ss"


code for Adding an image to a cell
In ultragrid InitializeLayout event
now you Add an image to resource file to access from My.Resources here in the below code
UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellButtonAppearance.Image = My.Resources.img

'img is the name image

'code for make Non Editable column and Editable column

'In ultragrid InitializeLayout event
'for code to allow if u want edit

UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellActivation = Activation.AllowEdit

'code for locking the cell
UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellActivation = Activation.NoEdit

code To add a band header
In ultragrid InitializeLayout event
'for header visibility true
UltraGrid1.DisplayLayout.Bands(0).HeaderVisible = True

' code for gave header name
UltraGrid1.DisplayLayout.Bands(0).Header.Caption = "My Header name is write here "

'code for aligning the header text appearence
UltraGrid1.DisplayLayout.Bands(0).Header.Appearance.TextHAlign = HAlign.right

'there are also other alignment setting in ultragrid


Friday, 24 May 2013

how to add image/icon and text in ultratool control on specific and all tab in vb.net

Hi everyone
that is the way to add image or icon on tab(specific ) and all tab of ultra Tab control

Step 1 :
Add image on your resource file folder on your code
Go on Your Solution Explore  and then go on My Project then click on Resources.resx
image select option then add image
After That
Step 2:
add this code in your Form. i add  image In my resource folder ambulance1_256 please change the name of pics with that
  This line is add for show same pics/icon on all tab

   'Me.UltraTabControl1.Appearance.Image = My.Resources.ambulance1_256
'Here is line for Adding image on tab 1 and tab 3

        Me.UltraTabPageControl1.Tab.Appearance.Image = My.Resources.ambulance1_256
        Me.UltraTabPageControl3.Tab.Appearance.Image = My.Resources.ambulance1_256
'for adding text in specific tab please write that code. i add on the first tab
 Me.UltraTabPageControl1.Tab.Text = "ahmad"
I Hope that code is helpful to you.if you need more help please tell me by comments

Regards:
Ahmad Khalid
Software Engineer