Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
GeneralRe: GetHashCode override for a value wrapper. Is mutable ok? Pin
GParkings14-Feb-12 2:56
GParkings14-Feb-12 2:56 
QuestionRaysharp Client SDK Pin
jayesh86.pkd13-Feb-12 22:49
jayesh86.pkd13-Feb-12 22:49 
AnswerRe: Raysharp Client SDK Pin
Dave Kreskowiak14-Feb-12 2:08
mveDave Kreskowiak14-Feb-12 2:08 
GeneralRe: Raysharp Client SDK Pin
jayesh86.pkd14-Feb-12 21:55
jayesh86.pkd14-Feb-12 21:55 
QuestionVisual C# dictionary Pin
csshtml13-Feb-12 22:07
csshtml13-Feb-12 22:07 
AnswerRe: Visual C# dictionary Pin
V.14-Feb-12 0:44
professionalV.14-Feb-12 0:44 
AnswerRe: Visual C# dictionary Pin
Eddy Vluggen14-Feb-12 5:06
professionalEddy Vluggen14-Feb-12 5:06 
AnswerRe: Visual C# dictionary Pin
PIEBALDconsult14-Feb-12 5:12
mvePIEBALDconsult14-Feb-12 5:12 
I doubt you'd want to have a whole dictionary in memory, but if it's just a small dictionary, something like this might be what you want (once you have the DataTable populated):

System.Data.DataTable dt = new System.Data.DataTable() ;
dt.Columns.Add ( new System.Data.DataColumn ( "Word" ) ) ;
dt.Columns.Add ( new System.Data.DataColumn ( "Definition" ) ) ;

System.Data.DataRow dr ;
        
dr = dt.NewRow() ;
dr [ 0 ] = "CAT" ;
dr [ 1 ] = "Man's worst enemy" ;
dt.Rows.Add ( dr ) ;
  
dr = dt.NewRow() ;
dr [ 0 ] = "CART" ;
dr [ 1 ] = "Don't put it before the horse" ;
dt.Rows.Add ( dr ) ;
  
dr = dt.NewRow() ;
dr [ 0 ] = "COT" ;
dr [ 1 ] = "A place to rest at work" ;
dt.Rows.Add ( dr ) ;
  
this.comboBox1.DataSource = dt.DefaultView ;
this.comboBox1.DisplayMember = "Word" ;
this.comboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend ;
this.comboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems ;
this.comboBox1.SelectedIndexChanged += delegate ( object sender , System.EventArgs e )
{
  this.textBox1.Text = (string) ((System.Data.DataRowView) this.comboBox1.SelectedItem) [ 1 ] ;
} ;


This may not provide all the searching you want. If not, another similar possibility is to have a TextBox for the search pattern. When the Text is changed, you set the .Filter property of the DataTable's DefaultView -- but you have to catch Exceptions and let the user know that the pattern has a problem.

Here's one (untested) way to do that:

System.Data.DataView dv = this.cbItemName.DataSource as System.Data.DataView ;
if ( dv != null )
{
  try
  {
    dv.RowFilter = System.String.Format ( "Name LIKE '%{0}%'" , this.tbSearchText.Text ) ;

    this.tbSearchText.BackColor = System.Drawing.SystemColors.Window ;
  }
  catch
  {
    this.tbSearchText.BackColor = System.Drawing.Color.LightPink ;
  }

GeneralRe: Visual C# dictionary Pin
csshtml14-Feb-12 6:34
csshtml14-Feb-12 6:34 
QuestionFolder lock Pin
aniperiye13-Feb-12 19:59
aniperiye13-Feb-12 19:59 
AnswerRe: Folder lock Pin
lukeer13-Feb-12 20:49
lukeer13-Feb-12 20:49 
QuestionC sharp windows service Pin
candogu13-Feb-12 19:53
candogu13-Feb-12 19:53 
AnswerRe: C sharp windows service Pin
V.13-Feb-12 20:55
professionalV.13-Feb-12 20:55 
GeneralRe: C sharp windows service Pin
candogu14-Feb-12 0:17
candogu14-Feb-12 0:17 
AnswerRe: C sharp windows service Pin
V.14-Feb-12 0:40
professionalV.14-Feb-12 0:40 
AnswerRe: C sharp windows service Pin
Eddy Vluggen14-Feb-12 5:10
professionalEddy Vluggen14-Feb-12 5:10 
GeneralRe: C sharp windows service Pin
candogu15-Feb-12 21:12
candogu15-Feb-12 21:12 
Questiondwg image conversion Pin
venkatesan5913-Feb-12 18:19
venkatesan5913-Feb-12 18:19 
AnswerRe: dwg image conversion Pin
Dave Kreskowiak14-Feb-12 1:58
mveDave Kreskowiak14-Feb-12 1:58 
Question2d array help me Pin
Beansenu13-Feb-12 7:21
Beansenu13-Feb-12 7:21 
AnswerRe: 2d array help me Pin
fjdiewornncalwe13-Feb-12 8:35
professionalfjdiewornncalwe13-Feb-12 8:35 
AnswerMy Vote of 1 Pin
Keith Barrow13-Feb-12 9:06
professionalKeith Barrow13-Feb-12 9:06 
AnswerRe: 2d array help me Pin
Not Active13-Feb-12 9:27
mentorNot Active13-Feb-12 9:27 
GeneralRe: 2d array help me Pin
Eddy Vluggen13-Feb-12 10:01
professionalEddy Vluggen13-Feb-12 10:01 
GeneralRe: 2d array help me Pin
Not Active13-Feb-12 14:51
mentorNot Active13-Feb-12 14:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.