 |
|
 |
Hi This was exactly i was looking for but is it possible for anybody to re-write it in vb.net.. i have no clue about C# and any other apart from vb.net.... Any help focus or is there any other way to do the same in vb.net...??.. Gurdeep
Plz email me at gurdeeptoor@yahoo.ie
Thanks in advance
|
|
|
|
 |
|
 |
Don't need to have it VB. Just compile the project code as a DLL and drop the DLL into your VB project as a reference then add the dll as an item to your toolbox.
|
|
|
|
 |
|
 |
Hi,
does anyone know how to modify this code to get the the columns to sort when I click on the column header?
|
|
|
|
 |
|
 |
I'm waiting for the same function.
|
|
|
|
 |
|
 |
When I was using this control, I noticed some things
1. The row that was selected, was not returned. So we couldn't use any values from other columns
Solution
(CHANGES IN MultiColumnComboBox.cs)
private void MultiColumnComboBox_AfterSelectEvent(object sender, DataRow drow){
try{
if(drow!=null){
this.SelectedRow = drow;
this.Text = drow[displayMember].ToString();
}
}catch(Exception exp){
MessageBox.Show(this,exp.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
2. There was no possibility to open the listview and select the row accordingly to the data in the combobox.
Solution
(CHANGES IN MultiColumnComboPopup.cs)
///
/// Function that will select the row with the given value.
///
/// Value to select in the listview
/// Integer, containing the selected rownumber
public int SetValue(string ItemToDisplay)
{
int intRow = -1;
for(int i=0;i0)
// These controls are on a tabpage
popup.Location=new Point(parent.Left + this.Left + 16, parent.Top + this.Bottom + this.Height + 190 + 22);
else if (this.Name.ToString()=="cboPresentation")
popup.Location=new Point(parent.Left + this.Left + 16 - 292 + this.Width, parent.Top + this.Bottom + this.Height );
else
popup.Location=new Point(parent.Left + this.Left + 8 ,parent.Top + this.Bottom + this.Height);
popup.Show();
if (popup.lstvMyView.SelectedIndices.Count > 0)
popup.lstvMyView.EnsureVisible(popup.lstvMyView.SelectedIndices[0]);
if(AfterSelectEvent!=null)
AfterSelectEvent();
}
base.OnDropDown(e);
}
catch (Exception ex)
{
throw ex;
}
}
|
|
|
|
 |
|
 |
In order to position the popup I use the following code in the OnDropDown event method:
popup.Location = this.PointToScreen (new Point(0,this.Height));
Anders Norell
Software engineer, Sweden
|
|
|
|
 |
|
 |
how insert Multi Column ComboBox in to DataGridView?
|
|
|
|
 |
|
|
 |
|
 |
Sorry for my english
i dont't have access this page bat i think it is a not MultiColumnComboBox. Where a can find MultiColumComboBox control for add in the DataDridView
fank you
|
|
|
|
 |
|
 |
Hi,
Sorry for my english.
this Control is a greate work!
But have a problem when is into other objects (tab,groupbox,childform).
The problem is because the control use the x,y positions of the parent form.
I find a method to correct it (I Guess? ).
First. (using directive System.Runtime.InteropServices for using call API's )
Second.(Define a class with Calls to Api's in same namespace MyCustomControls.InheritedCombo)
using System.Runtime.InteropServices ;
namespace MyCustomControls.InheritedCombo
{
...
...
public class MultiColumnComboBox : System.Windows.Forms.ComboBox
{
...
}
public class Win32
{
[DllImport("user32.dll")]
public static extern bool GetWindowRect(int hWnd,
ref RECT lpRect);
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
}
}
Explain:
The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
Three. (Using the GetWindowRect() API )
protected override void OnDropDown(System.EventArgs e)
{
// Define a structure
Win32.RECT xrec = new MyCustomControls.InheritedCombo.Win32.RECT();
// Using GetWindowRect with this.Handle (Combobox) as parent and
// the structure create before to have the positions (x,y,x2,y2)
Win32.GetWindowRect( (int) this.Handle, ref xrec );
// No use it
//Form parent = this.FindForm();
if(this.dataTable != null || this.dataRows!= null)
{
MultiColumnComboPopup popup = new MultiColumnComboPopup(this.dataTable,ref this.selectedRow,columnsToDisplay);
popup.AfterRowSelectEvent+=new AfterRowSelectEventHandler(MultiColumnComboBox_AfterSelectEvent);
// No use it
//popup.Location = new Point(parent.Left + this.Left + 4 ,parent.Top + this.Bottom + this.Height);
// Now use the values of RECT structure for draw the popup
popup.Location = new Point( xrec.Left, xrec.Bottom ) ;
popup.Show();
if(popup.SelectedRow!=null)
{
try{
this.selectedRow = popup.SelectedRow;
this.displayValue = popup.SelectedRow[this.displayMember].ToString();
this.Text = this.displayValue;
}
catch(Exception e2)
{ MessageBox.Show(e2.Message,"Error"); }
}
if(AfterSelectEvent!=null)
AfterSelectEvent();
}
base.OnDropDown(e);
}
Explain:
On the event OnDropDown create a var type RECT.
Use the Function GetWindowRect for know the position of combobox.
Use the values of structure for draw the listbox.
AGarcia
Guatemala, C.A.
|
|
|
|
 |
|
 |
The same fix may be obtained replacing the line
popup.Location = new Point(parent.Left + this.Left + 4 ,parent.Top + this.Bottom + this.Height);
with the following
popup.Location = this.PointToScreen(new Point(4, this.Height));
Cheers, Claudio Benghi
|
|
|
|
 |
|
 |
Has anyone solved the issue that when you click the dropdown the multi-column list appears as expected but you also get the standard dropdown list portion of the control flicking up and then disappearing???
Would be great if this flcking did not occur and the multi-column list simply appeared
|
|
|
|
 |
|
 |
The flicker will always show when overriding the OnDropDownEvent. To solve this you need to override the WndProc instead and catch the messages that ultimately will cause the OnDropDownEvent.
More information on how to do this can be found here: http://ilvyanyatka.spaces.live.com/blog/cns!EA0C02AB2E2FCFAC!198.entry
|
|
|
|
 |
|
 |
public MultiColumnComboBox(System.ComponentModel.IContainer container)
{
container.Add(this);
InitializeComponent();
Type t = this.GetType().BaseType;
FieldInfo tPropDropDownHeight = t.GetField("PropDropDownHeight", BindingFlags.NonPublic | BindingFlags.Static);
if (tPropDropDownHeight == null)
return;
object propDropDownHeight = (int)tPropDropDownHeight.GetValue(this);
FieldInfo tProperties = t.BaseType.BaseType.GetField("propertyStore", BindingFlags.NonPublic | BindingFlags.Instance);
object propertyStore = tProperties.GetValue(this);
Type tPropertyStore = propertyStore.GetType();
MethodInfo setInteger = tPropertyStore.GetMethod("SetInteger", BindingFlags.Public | BindingFlags.Instance);
setInteger.Invoke(propertyStore, new object[] { (Int32)propDropDownHeight, (Int32)0 });
}
|
|
|
|
 |
|
 |
I have problem with multipleColumnComboBox I can't "take" multComBox.ValueMember. I need to take multComBox.ValueMember and to show for example in one Label and when I change multColumnComboBox.DisplayMember atomatic to change the value in Label for multColumnComboBox.ValueMamber.
Thank you!!
|
|
|
|
 |
|
 |
Does anyone know how to get back and set the value to Multi Column ComboBox ?
It is possible use DataBindings.Add to bind to Multi Column ComboBox ? If yes, how to do ?
Thank you
|
|
|
|
 |
|
 |
hellow
i need multy column DropDownlist in my web project
my asp.net web project needs to a custom drop downlist with multy column
please help me!
|
|
|
|
 |
|
|
 |
|
 |
Great Work!
only one thing I've found:
private void MultiColumnComboBox_AfterSelectEvent(object sender, DataRow drow){
try{
if(drow!=null){
this.Text = drow[displayMember].ToString();
this.selectedRow = drow;
}
}catch(Exception exp){
MessageBox.Show(this,exp.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
after inserting this line into your code, the combo-property "SelectedRow" returns the indexed values of the previously selected row.
Will you post an updated version with autocomplete?
|
|
|
|
 |
|
 |
I followed your suggestion and used "this.selectedRow = drow;" and nothing happens. I can't get the combobox or the listview to display the selected items.
Did anyone find a solution?
This seems to be a really awesome tool and I can't get it to work the way the demo does
|
|
|
|
 |
|
 |
Has anyone been able to implement this control using the DropDownList style. When I try and use this style, I get an object not set error. If anyone has managed to do this, I would really appreciate a message or two regarding how this is done.
Thanks
|
|
|
|
 |
|
 |
Hi All
Does anyone know how to get back the selected row or set the selected row in the multi-column combo box. I have tried using SelectedValue or SelectedItem, but with no luck.
Any ideas would be appreciated.
|
|
|
|
 |
|
 |
I made modifications to the MultiColumnComboBox and MultiColumnComboPopup files with the following additions:
- The text portion of the combo box auto-completes the text.
- When you dropdown the combo box, the listview highlights the closest match in the list.
The second, where the listview highlights a specific row in the list might be part of what you are looking for. Submit another post or e-mail me directly and I can either e-mail you the updated .cs files, or tell you how to make the changes. Then again, this may be nothing like what you are looking for.
|
|
|
|
 |
|
 |
Hi,
Can you please send me the updated code on pisal_sachin@yahoo.com
thanks a lots.
Regards,
sac
|
|
|
|
 |
|
 |
Hi,
Can you please send me the updated code on javad_pishvaei@yahoo.com
thanks a lots.
javad
ya ali!
|
|
|
|
 |