|
Do you want to learn Visual Basic? You can start right here. Make your first steps and read Visual Basic examples and articles for beginners.
|
C#
// Set column styles
// Set datagrid ColumnStyle for Car field
DataGridTextBoxColumn colCar = new DataGridTextBoxColumn();
colCar.MappingName = "Car";
colCar.HeaderText = "Car Name";
colCar.Width = 130;
colCar.NullText = String.Empty;
colCar.ReadOnly = true;
TblStyle.GridColumnStyles.Add(colCar);
// Set datagrid ComboBox ColumnStyle for PubID field
DataTable tblCompanies = ds.Tables["Companies"];
TblStyle.GridColumnStyles.Add(new DataGridComboBoxColumn(ref tblCompanies, 1, 0, true, false, true));
// Datagrid ComboBox DisplayMember field has order number 1. Name of this column is "Name"
// Datagrid ComboBox ValueMember field has order number 0. Name of this column is "PubID"
TblStyle.GridColumnStyles[1].MappingName = "PubID";
TblStyle.GridColumnStyles[1].HeaderText = "Company ID";
TblStyle.GridColumnStyles[1].Width = 200;
TblStyle.GridColumnStyles[1].NullText = String.Empty;
// Set datagrid combobox ColumnStyle for State field
DataTable tblStates = ds.Tables["States"];
TblStyle.GridColumnStyles.Add(new DataGridComboBoxColumn(ref tblStates, 0, 0, true, false, false));
// Datagrid ComboBox DisplayMember field has order number 0. Name of this column is "State"
// Datagrid ComboBox ValueMember field has order number 0. It is the same column like for DisplayMember
TblStyle.GridColumnStyles[2].MappingName = "State";
TblStyle.GridColumnStyles[2].HeaderText = "State";
TblStyle.GridColumnStyles[2].Width = 45;
TblStyle.GridColumnStyles[2].NullText = String.Empty;
// Set datagrid XP Style Button ColumnStyle for City field
TblStyle.GridColumnStyles.Add(new DataGridXPButtonColumn());
// Also you may set datagrid Button ColumnStyle for City
// field without XP Button Style as the following:
// .Add(New DataGridButtonColumn())
TblStyle.GridColumnStyles[3].MappingName = "City";
TblStyle.GridColumnStyles[3].HeaderText = "City";
TblStyle.GridColumnStyles[3].Width = 60;
TblStyle.GridColumnStyles[3].NullText = String.Empty;
// Set datagrid Memo ColumnStyle for Comments field
TblStyle.GridColumnStyles.Add(new DataGridMemoColumn("Car description"));
TblStyle.GridColumnStyles[4].MappingName = "Comments";
TblStyle.GridColumnStyles[4].HeaderText = "Comments";
TblStyle.GridColumnStyles[4].Width = 60;
|
VB .NET
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Retrieve all the Company Names in the table
Dim AppPath As String = Mid(Application.ExecutablePath, 1, Len(Application.ExecutablePath) - 14)
Dim strConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " + AppPath + "Samples.mdb"
Dim dbConn As System.Data.OleDb.OleDbConnection = _
New System.Data.OleDb.OleDbConnection(strConn)
dbConn.Open()
Dim DSet As New DataSet, SQLStr As String
Dim cmd As System.Data.OleDb.OleDbCommand
Dim dbAdaptr As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
Dim tRow As DataRow, tTbl As DataTable
With dbAdaptr
.TableMappings.Add("Table", "Companies")
SQLStr = "Select [Company Name] from Companies"
cmd = New System.Data.OleDb.OleDbCommand(SQLStr, dbConn)
cmd.CommandType = CommandType.Text
.SelectCommand = cmd
.Fill(DSet)
.Dispose()
End With
DSet.AcceptChanges()
tTbl = DSet.Tables.Item(0)
DSet.Dispose()
dbConn.Close()
' fill out array by Company Names for cboRightCombo combobox
cboRightCombo.Text = ""
cboRightCombo.Items.Clear()
cboRightCombo.BeginUpdate()
' Load the Company Names into the ComboBox Control
For Each tRow In tTbl.Rows
cboRightCombo.Items.Add(tRow("Company Name").ToString)
Next
cboRightCombo.EndUpdate()
End Sub
' Close application
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles cmdClose.Click
Me.Close()
End Sub
' Use event "Change" for alphabetical search an appropriate
' value in combo box list and put it into combobox Text.
Private Sub cboRightCombo_TextChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles cboRightCombo.TextChanged
Dim boxIndex As Integer, lExst As Boolean
Dim box As ComboBox = sender
Dim txt As String = box.Text
Dim posCursor As Integer = box.SelectionStart
' If Cursor does not stay on the beginning of text box.
If posCursor <> 0 Then
lExst = False
' Go in cycle through the combo box list to
' find the appropriate entry in the list
For boxIndex = 0 To box.Items.Count - 1
If UCase(Mid(box.Items(boxIndex), 1, posCursor)) = UCase(Mid(txt, 1, posCursor)) Then
box.Text = box.Items(boxIndex)
box.SelectionStart = posCursor
lExst = True
Exit For
End If
Next
' We didn't find appropriate entry and return previous value to text box
If Not lExst Then
box.Text = Mid(txt, 1, posCursor - 1) + Mid(txt, posCursor + 1)
box.SelectionStart = posCursor - 1
End If
End If
End Sub
End Class
|
Run the project and
type some text into the combobox, and if it matches the text in the list of
your combobox then the text will be displayed in the combobox.
|
2.
Remove duplicates from an array
How to remove the duplicates in a string array? Here
is an example of deleting double elements in an array. This example removes all
the duplicate elements from the array InitialArray and create from it the new FinalArray.
|
4. How to remove element from Collection?
How to remove element from Collection if you know
its Name and don't know its index? Use the Remove method of Collection, which
will take the Collection Item by the index parameter and permanently remove it
from your collection. In this example we first add some Items to the
colVariables Collection. We then walk through this collection to locate the
Item with Name "BMW". Once we do locate it we use the Remove method to delete
it from the collection and exit the For.Next.
|
5. How to do an alphabetical search in a list box?
How to create alphabetical search in a list box by typing text into a textbox
control? Above we did it for Combobox control. In this example we will try
another way to do that for a textbox. This is possible to do by using the SendMessage API function.
|
VB 6
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd _
As Long, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
Const VB_SEARCHSTR = &H18F
Private Sub Form_Load()
' Load some alphabetically ordered info into the List Box Control
With lstBox
.Clear
.AddItem "abaca"
.AddItem "abbot"
.AddItem "abdicate"
.AddItem "aberrance"
.AddItem "aboriginal"
.AddItem "accede"
.AddItem "acephalous"
.AddItem "ache"
.AddItem "actinium"
.AddItem "addendum"
.AddItem "adjourn"
.AddItem "affability"
.AddItem "agelong"
End With
End Sub
' Event "Change" is used for alphabetical search an
' appropriate value in list box and put it into Text box.
Private Sub txtBox_Change ()
Dim prvsTxt As String
Dim txt As String, posCursor As Integer
posCursor = txtBox.SelStart
' If Cursor does not stay on the beginning of text box.
If posCursor <> 0 Then
' keep previous value of the text box
prvsTxt = Trim(txtBox.Text)
' keep piece of text before cursor
txt = Left(prvsTxt, posCursor)
' Call API function to find the appropriate entry in the list box
lstBox.ListIndex = SendMessage (lstBox.hWnd, VB_SEARCHSTR, -1, ByVal txt)
' We have found appropriate value
If lstBox.ListIndex <> -1 Then
txtBox.Text = lstBox.Text
txtBox.SelStart = posCursor
' We didn't find appropriate entry and return previous value to text box
Else
txtBox.Text = Left(prvsTxt, posCursor - 1) + Mid(prvsTxt, posCursor + 1)
txtBox.SelStart = posCursor - 1
EndIf
EndIf
End Sub
' Close application
Private Sub
cmdCancel_Click()
Unload Me
End Sub
|
Just download this example and run it. Then type some text into the txtBox text
box. If it matches in alphabetical order the text in the lstBox listbox then the text will appear in the text box.
|
VB .NET
' Set datagrid column styles
With TableStyle.GridColumnStyles
' Set datagrid ColumnStyle for Car field
.Add(New DataGridTextBoxColumn(tblCrrncMngr.GetItemProperties.Item("Car")))
With .Item(0)
.MappingName = "Car"
.HeaderText = "Car Name"
.Width = 130
.NullText = String.Empty
.ReadOnly = True
End With
' Set datagrid ComboBox ColumnStyle for PubID field
.Add(New DataGridComboBoxColumn(ds.Tables.Item("Companies"), 1, 0))
' Datagrid ComboBox DisplayMember field has order number 1. Name of this column is "Name"
' Datagrid ComboBox ValueMember field has order number 0. Name of this column is "PubID"
With .Item(1)
.MappingName = "PubID"
.HeaderText = "Company ID"
.Width = 200
.NullText = String.Empty
End With
......................
' Set datagrid XP Style Button ColumnStyle for City field
.Add(New DataGridXPButtonColumn(SystemColors.ControlText, SystemColors.Control))
' Also you may set datagrid Button ColumnStyle for City
' field without XP Button Style as the following:
' .Add(New DataGridButtonColumn())
With .Item(3)
.MappingName = "City"
.HeaderText = "City"
.Width = 60
.NullText = String.Empty
End With
End With
......................
' DataGridXPButtonColumn Click event runs when the datagrid XPButtonColumn Style's
' Button control is clicked. The Sub receives three arguments:
' sender as DataGridXPButtonColumn, ColumnMappingName and ColumnValueAtRow of String type
Private Sub XPButtonColumn_Click(ByVal sender As DataGridXPButtonColumn, _
ByVal ColumnMappingName As String, _
ByVal ColumnValueAtRow As String) Handles XPButtonColumn.Click
If ColumnMappingName = "City" Then
Dim strValue As String
If IsDBNull(DataGrid1.Item(DataGrid1.CurrentRowIndex, 3)) Then
strValue = "Nothing :("
Else
strValue = ColumnValueAtRow + " city, " + DataGrid1.Item(DataGrid1.CurrentRowIndex, 2) + "!"
End If
MessageBox.Show("You have chosen " + strValue, "DataGrid Button is clicked!")
End If
End Sub
|
C#
// Set column styles
// Set datagrid ColumnStyle for Car field
DataGridTextBoxColumn colCar = new DataGridTextBoxColumn();
colCar.MappingName = "Car";
colCar.HeaderText = "Car Name";
colCar.Width = 130;
colCar.NullText = String.Empty;
colCar.ReadOnly = true;
TblStyle.GridColumnStyles.Add(colCar);
// Set datagrid ComboBox ColumnStyle for PubID field
DataTable tblCompanies = ds.Tables["Companies"];
TblStyle.GridColumnStyles.Add(new DataGridComboBoxColumn(ref tblCompanies, 1, 0, true, false, true));
// Datagrid ComboBox DisplayMember field has order number 1. Name of this column is "Name"
// Datagrid ComboBox ValueMember field has order number 0. Name of this column is "PubID"
TblStyle.GridColumnStyles[1].MappingName = "PubID";
TblStyle.GridColumnStyles[1].HeaderText = "Company ID";
TblStyle.GridColumnStyles[1].Width = 200;
TblStyle.GridColumnStyles[1].NullText = String.Empty;
......................
// Set datagrid XP Style Button ColumnStyle for City field
TblStyle.GridColumnStyles.Add(new
DataGridXPButtonColumn(SystemColors.ControlText, SystemColors.Control));
// Also you may set datagrid Button ColumnStyle for City
// field without XP Button Style as the following:
// .Add(New DataGridButtonColumn())
TblStyle.GridColumnStyles[3].MappingName = "City";
TblStyle.GridColumnStyles[3].HeaderText = "City";
TblStyle.GridColumnStyles[3].Width = 60;
TblStyle.GridColumnStyles[3].NullText = String.Empty;
......................
// DataGridXPButtonColumn Click event runs when the datagrid XPButtonColumn Style's
// Button control is clicked. The procedure receives three arguments:
// sender as DataGridXPButtonColumn, ColumnMappingName and ColumnValueAtRow of String type
public void XPButtonColumn_Click(DataGridXPButtonColumn sender, string ColumnMappingName, string ColumnValueAtRow)
{
if (ColumnMappingName == "City") {
String strValue;
if (DataGrid1[DataGrid1.CurrentRowIndex, 3] == DBNull.Value) {
strValue = "Nothing :(";
}
else {
strValue = ColumnValueAtRow + " city, " + DataGrid1[DataGrid1.CurrentRowIndex, 2] + "!";
}
MessageBox.Show("You have chosen " + strValue, "DataGrid Button is clicked!");
}
}
|
7. .Net DataGrid Memo column Style.
The RustemSoft DataGridMemoColumn gives you a useful Memo Field control, which presents an edit window when user selects a cell of the DataGrid Memo Column on .NET DataGrid. This provides a pop-up memo field editor that you can call from your code at any time to let users edit the text in a memo field.
This Memo field editor provides more flexibility by updating the memo field to be used in a .NET DataGrid column.
The DataGrid Memo Column Memo field editor is useful for showing short document contents, like memos and emails.
When using the DataGrid Memo Column editor you are automatically provided with all general features, which any typical, contemporary word processor has.
|
8. .Net DataGrid DateTimePicker column Style.
The DateTimePicker ColumnStyle is used to allow the user to select a date and time, and to display that date/time in your DataGrid.
|
9. How to Trap the Tab Key in a .NET Control?
You are trying to create a control in .NET, and your control has to catch the Tab key. It might be a grid, where you would expect Tab to move between cells, or it might be an editor control. Now you would like to catch Tab and some other navigation keys that do not call OnKeyDown or OnKeyUp. How to intercept Tabs properly in .NET?
You have to create a class that inherits from the System.Windows.Forms.Control and override the ProcessKeyMessage method. This method is called when a control receives a keyboard message. You suppose to trap the Tab on your Button. Just override the System.Windows.Forms.Button class and create your own MyButton class:
|
In your custom code you will be able to identify which key has been pressed before your button was activated:
|
If MyButton.PreProcessKey = Keys.Tab Then MsgBox("Tab is pressed!")
|
if (System.Windows.Forms.Keys.Tab.Equals(myButton.PreProcessKey)) MessageBox.Show("Tab is pressed!");
|
How to change the background color for DataGridComboBoxColumn columns in a datagrid?
The DataGridComboBoxColumn's combo object has the same properties as the .NET ComboBox control.
The following example sets the BackColor property so that will display red background.
This code assumes that an instance of a DataGridComboBoxColumn grid column style has been created on your custom DataGrid.
|
How to change the display format for DateTimePicker columns in a datagrid?
The DataGridDateTimePicker's picker object has the same properties as the .NET DateTimePicker control.
The following example sets the CustomFormat property so that the will display the date as "12/31/2003".
This code assumes that an instance of a DataGridDateTimePicker grid column style has been created on your custom DataGrid.
|
To empty a DateTimePickerColumn cell runtime just click the right mouse button when the cell is selected.
To empty a DateTimePickerColumn cell runtime just click the right mouse button when the cell is selected.
How to setup the combo box that filters values from a related child table?
The DataGridComboBoxColumn column style control gives an ability to get a nesting combo box that filters values from a related child table. In a dictionary grid, you can view and edit related data in a child table.
In our sample database we have "Corps" Master table that has a one-to-many relationship with a "Cars" Child table; so for each row of the "Corps" table in Dictionary grid, we can view and edit the related rows of the "Cars" child table in a dictionary grid. These two tables are related each other by fields key: "ID + Corp".
For this case we have to define two string arrays with key fields' names MasterFields and ChildFields. To get the filtering we must identify Master and Child tables' key fields. These fields names in both arrays must have the same order sequence.
|
How to specify what Dictionary datagrid columns will be shown?
DataGridComboBoxColumn ActivateDictionary event runs when the datagrid ComboBoxColumn Style's
nesting Dictionary datagrid is activated (the additional dropdown button is clicked).
We use the procedure to specify what dictionary columns will be shown.
|
C#
// Define "Models" Dictionary Grid Column
ModelColumn = (DataGridComboBoxColumn) DataGrid1.TableStyles[0].GridColumnStyles[3];
// ModelColumn object handles the
// RustemSoft.DataGridColumns.DataGridComboBoxColumn.ActivateDictionary event
ModelColumn.ActivateDictionary +=
new RustemSoft.DataGridColumns.DataGridComboBoxColumn.ActivateDictionaryEventHandler(this.ModelColumn_ActivateDictionary);
.............
private void ModelColumn_ActivateDictionary(DataGridComboBoxColumn sender)
{
DataGridTableStyle TableStyle = new DataGridTableStyle();
GridColumnStylesCollection DictionrGridColumns = TableStyle.GridColumnStyles;
// Define columns
DictionrGridColumns.Add(new DataGridTextBoxColumn());
DictionrGridColumns[0].MappingName = "ModelID";
DictionrGridColumns[0].HeaderText = "Model ID";
DictionrGridColumns[0].Width = 40;
DictionrGridColumns[0].NullText = String.Empty;
DictionrGridColumns.Add(new DataGridTextBoxColumn());
DictionrGridColumns[1].MappingName = "Model";
DictionrGridColumns[1].HeaderText = "Model";
DictionrGridColumns[1].Width = 60;
DictionrGridColumns[1].NullText = String.Empty;
DataTable tblBodyStyle = ds.Tables["BodyStyle"];
// One more DataGridComboBoxColumn object is enclosed into the datagrid
DictionrGridColumns.Add(new DataGridComboBoxColumn(ref tblBodyStyle, 0, 0, true, false, true, RustemSoft.DataGridColumns.DataGridComboBoxColumn.DisplayModes.ShowDisplayMember,0));
DictionrGridColumns[2].MappingName = "Body Style";
DictionrGridColumns[2].HeaderText = "Body Style";
DictionrGridColumns[2].Width = 120;
DictionrGridColumns[2].NullText = String.Empty;
DictionrGridColumns.Add(new DataGridNumericColumn(true, true, DateTime.Now.Year, 1955, 2020, 4, null));
DictionrGridColumns[3].MappingName = "Year";
DictionrGridColumns[3].HeaderText = "Year";
DictionrGridColumns[3].Width = 50;
DictionrGridColumns[3].NullText = String.Empty;
// Define Dictionary Grid Columns Styles
ModelColumn.combo.DictionaryGridColumns = DictionrGridColumns;
// Define Dictionary Grid Height
ModelColumn.combo.DictionaryGridHeight = 250;
// Define Dictionary Grid Width
ModelColumn.combo.DictionaryGridWidth = 350;
}
|
How to format a datagrid column using Numeric, DateTime formats? How to mask data in the column?
These formatted intelligent DateTimeColumn, NumericColumn, TextFractionsColumn style controls can mask the date, time, numbers, digits, decimal as well as the text fractions. It gives you ability to manage the IP Address, SS#, Phone numbers, etc., and checks the validation, and automatically set the delimiter location.
|
VB .NET
' Set datagrid DateTime ColumnStyle for TimeFirst field
.Add(New DataGridDateTimeColumn(DateTimeTextBox.Stencils.HHMM24, Now, ":"))
With .Item(6)
.MappingName = "TimeFirst"
.HeaderText = "Time"
.Width = 40
.NullText = String.Empty
End With
' Set datagrid Numeric ColumnStyle for Price field
.Add(New RustemSoft.DataGridColumns.DataGridNumericColumn(, True, , , , , 2))
With .Item(7)
.MappingName = "Price"
.HeaderText = "Price"
.Width = 60
.NullText = String.Empty
End With
' Set datagrid TextFractions ColumnStyle for Phone field
.Add(New RustemSoft.DataGridColumns.DataGridTextFractionsColumn)
With .Item(8)
.MappingName = "Phone"
.HeaderText = "Phone"
.Width = 80
.NullText = String.Empty
End With
End With
End With
' Add TableStyle
DataGrid1.TableStyles.Add(TblStyle)
' Define NumericColumn DataGridNumericColumn object for Price field
Dim NumericColumn As DataGridNumericColumn = DataGrid1.TableStyles(0).GridColumnStyles(7)
' Specify back color for the field
NumericColumn.txtBox.box.BackColor = System.Drawing.Color.LightPink
' You may turn error messages off
'NumericColumn.txtBox.box.ErrMessageVisible = False
' You can specify an error message in your native language:
'NumericColumn.txtBox.box.ErrMessageNumericOnly = "Veuillez crire les nombres seulement!"
' Identify PhoneColumn object that is the DataGridTextFractionsColumns child
Dim PhoneColumn As DataGridTextFractionsColumn = DataGrid1.TableStyles(0).GridColumnStyles(8)
' Specify Delimiter Character for the field
PhoneColumn.txtBox.box.DelimiterChar = "-"
' Specify first fraction properties
' Alphanumeric symbols only are acceptable for the fraction
PhoneColumn.txtBox.box.FractionsCode(0, 0) = "a"
' You can insert 3 symbols only into the first fraction
PhoneColumn.txtBox.box.FractionsCode(0, 1) = 3
' Specify second fraction properties
' Numeric symbols only are acceptable for the fraction
PhoneColumn.txtBox.box.FractionsCode(1, 0) = "n"
' You can insert 3 symbols only into the second fraction
PhoneColumn.txtBox.box.FractionsCode(1, 1) = 3
' Specify third fraction properties
' Numeric symbols only are acceptable for the fraction
PhoneColumn.txtBox.box.FractionsCode(2, 0) = "n"
' You can insert 4 symbols only into the third fraction
PhoneColumn.txtBox.box.FractionsCode(2, 1) = 4
' To specify Password column only one text fraction must be defined:
'' To let accept any symbols for the fraction we need leave first array element empty:
'PhoneColumn.txtBox.box.FractionsCode(0, 0) = ""
'' You can insert 30 symbols only into the password fraction
'PhoneColumn.txtBox.box.FractionsCode(0, 1) = 30
'' Specify Password Character for the field
'PhoneColumn.txtBox.box.PasswordChar = "*"
|
C#
// Set datagrid DateTime ColumnStyle for TimeFirst field
TblStyle.GridColumnStyles.Add(new DataGridDateTimeColumn(DateTimeTextBox.Stencils.HHMM24, DateTime.Now, ":"));
//TblStyle.GridColumnStyles.Add(new DataGridTextBoxColumn());
TblStyle.GridColumnStyles[6].MappingName = "TimeFirst";
TblStyle.GridColumnStyles[6].HeaderText = "Time";
TblStyle.GridColumnStyles[6].Width = 40;
TblStyle.GridColumnStyles[6].NullText = String.Empty;
// Set datagrid Numeric ColumnStyle for Price field
TblStyle.GridColumnStyles.Add(new DataGridNumericColumn(false, true, null, null, 1000000, null, 2));
//TblStyle.GridColumnStyles.Add(new DataGridTextBoxColumn());
TblStyle.GridColumnStyles[7].MappingName = "Price";
TblStyle.GridColumnStyles[7].HeaderText = "Price";
TblStyle.GridColumnStyles[7].Width = 60;
TblStyle.GridColumnStyles[7].NullText = String.Empty;
// Set datagrid TextFractions ColumnStyle for Phone field
TblStyle.GridColumnStyles.Add(new DataGridTextFractionsColumn());
TblStyle.GridColumnStyles[8].MappingName = "Phone";
TblStyle.GridColumnStyles[8].HeaderText = "Phone";
TblStyle.GridColumnStyles[8].Width = 80;
TblStyle.GridColumnStyles[8].NullText = String.Empty;
// Add TableStyle
DataGrid1.TableStyles.Add(TblStyle);
// Define NumericColumn DataGridNumericColumn object for Price field
DataGridNumericColumn NumericColumn = (DataGridNumericColumn) DataGrid1.TableStyles[0].GridColumnStyles[7];
// Specify back color for the field
NumericColumn.txtBox.box.BackColor = System.Drawing.Color.LightPink;
// You may turn error messages off
//NumericColumn.txtBox.box.ErrMessageVisible = false;
// You can specify an error message in your native language:
//NumericColumn.txtBox.box.ErrMessageNumericOnly = "Veuillez crire les nombres seulement!";
// Identify PhoneColumn object that is the DataGridTextFractionsColumns child
DataGridTextFractionsColumn PhoneColumn = (DataGridTextFractionsColumn) DataGrid1.TableStyles[0].GridColumnStyles[8];
// Specify Delimiter Character for the field
PhoneColumn.txtBox.box.DelimiterChar = "-";
// Specify first fraction properties
// Alphanumeric symbols only are acceptable for the fraction
PhoneColumn.txtBox.box.FractionsCode[0, 0] = "a";
// You can insert 3 symbols only into the first fraction
PhoneColumn.txtBox.box.FractionsCode[0, 1] = 3;
// Specify second fraction properties
// Numeric symbols only are acceptable for the fraction
PhoneColumn.txtBox.box.FractionsCode[1, 0] = "n";
// You can insert 3 symbols only into the second fraction
PhoneColumn.txtBox.box.FractionsCode[1, 1] = 3;
// Specify third fraction properties
// Numeric symbols only are acceptable for the fraction
PhoneColumn.txtBox.box.FractionsCode[2, 0] = "n";
// You can insert 4 symbols only into the third fraction
PhoneColumn.txtBox.box.FractionsCode[2, 1] = 4;
// To specify Password column only one text fraction must be defined:
// To let accept any symbols for the fraction we need leave first array element empty:
//PhoneColumn.txtBox.box.FractionsCode[0, 0] = "";
// You can insert 30 symbols only into the password fraction
//PhoneColumn.txtBox.box.FractionsCode[0, 1] = 30;
// Specify Password Character for the field
//PhoneColumn.txtBox.box.PasswordChar = "*";
|
VB .NET
Dim ln As New Line
ln.X_Left = 20
ln.Y_Left = 150
ln.X_Right = 100
ln.Y_Right = 10
ln.Color = Color.Blue
|
C#
Line ln = new Line();
ln.X_Left = 20;
ln.Y_Left = 150;
ln.X_Right = 100;
ln.Y_Right = 10;
ln.Color = Color.Blue;
|
|