How to select a item on rightclick using devexpress ListboxControl

To select a item on rightclick using devexpress ListboxControl you need to use the MouseDown Event.
See the samples below.

Sample C#

private void listBoxControl1_MouseDown(object sender, MouseEventArgs e)
{
	listBoxControl1.SelectedIndex = listBoxControl1.IndexFromPoint(new Point(e.X, e.Y));
}

Sample VB.NET

Private Sub listBoxControl1_MouseDown(sender As Object, e As MouseEventArgs)
	listBoxControl1.SelectedIndex = listBoxControl1.IndexFromPoint(New Point(e.X, e.Y))
End Sub

How to get the selected row index in Devexpress Xtragrid Control using C# and VB.NET

To get the selected row index in Devexpress Xtragrid Control using C# and VB.NET you can use the snippet below.

Samples

Sample C#

Sample VB.NET

Compatibility: working .NET 2.0 working .NET 3.0 not tested .NET 3.5 not working .NET 4.0 not working .NET 4.5not working .NET 4.6

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

How to autosize UILabel to Textsize in IOS using Objective-C

labelTest.text = @"This is my Teststring.This is my Teststring.This is my Teststring.This is my Teststring.This is my Teststring.This is my Teststring.";
labelTest.numberOfLines = 0;
[labelTest sizeToFit];

How to get focusedrow cell value using Devexpress XtraGrid in C# and VB.NET

To get focusedrow cell value using Devexpress XtraGrid in C# and VB.NET you can use one of the following ways.

Samples

Sample C#

Sample VB.NET

 

Compatibility: working .NET 2.0 working .NET 3.0 not tested .NET 3.5 not working .NET 4.0 not working .NET 4.5not working .NET 4.6

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

 

How to clear all Textboxes on a Form in C# or VB.NET

To clear all Textboxes on a Form in C# or VB.NET you can use the Extensions method in the snippet below.

Sample C#

public static void ClearTextboxes(this Form form)
{
	foreach (var item in form.Controls.OfType<TextBox>())
	{
		item.Text = string.Empty;
	}
}

Sample VB.NET

<System.Runtime.CompilerServices.Extension> _
Public Sub ClearTextboxes(form As Form)
	For Each item As TextBox In form.Controls.OfType(Of TextBox)()
		item.Text = String.Empty
	Next
End Sub

How to change Checkstate of an item in a checkedlistbox control in C# or VB.NET

To change the Checkstate of an item in a checkedlistbox control in C# or VB.NET you can use the SetItemCheckState method of the checkedlistbox control.

Sample C#

private void ChangeCheckStateForAllCheckBoxes(bool check) {
    for (int i = 0; i <= (checkedListBox1.Items.Count - 1); i++) {
        if (check)
        {
            checkedListBox1.SetItemCheckState(i, CheckState.Checked);
        }
        else
        {
            checkedListBox1.SetItemCheckState(i, CheckState.Unchecked);
        }
    }  
}

Sample VB.NET

Private Sub ChangeCheckStateForAllCheckBoxes(check As Boolean)
	For i As Integer = 0 To (checkedListBox1.Items.Count - 1)
		If check Then
			checkedListBox1.SetItemCheckState(i, CheckState.Checked)
		Else
			checkedListBox1.SetItemCheckState(i, CheckState.Unchecked)
		End If
	Next
End Sub

for more informations see CheckedListBox.ObjectCollection Class, CheckedListBox.SetItemChecked Method