Click here to Skip to main content
16,005,121 members
Home / Discussions / C#
   

C#

 
GeneralRe: snapshot of folder structure Pin
rajml3-May-05 1:19
rajml3-May-05 1:19 
Generaladd reference for Microsoft.Office.Core dll Pin
rathishps2-May-05 22:43
rathishps2-May-05 22:43 
GeneralRe: add reference for Microsoft.Office.Core dll Pin
A Khan2-May-05 23:11
sussA Khan2-May-05 23:11 
GeneralRe: add reference for Microsoft.Office.Core dll Pin
ankur.sharma.2358-Aug-16 23:56
ankur.sharma.2358-Aug-16 23:56 
Generalcombobox and auto-completion Pin
gibono2-May-05 22:39
gibono2-May-05 22:39 
GeneralRe: combobox and auto-completion Pin
Dan_P2-May-05 22:54
Dan_P2-May-05 22:54 
GeneralRe: combobox and auto-completion Pin
Anonymous2-May-05 23:42
Anonymous2-May-05 23:42 
GeneralRe: combobox and auto-completion Pin
jklucker3-May-05 7:19
jklucker3-May-05 7:19 
Sample c#
<br />
//************************************************************************************<br />
		//   Call the corresponding functions from your form's Combobox's KeyUp and<br />
		//   Leave events<br />
		//************************************************************************************<br />
		private void ACCombo_KeyUp(ComboBox cbo, KeyEventArgs e)<br />
		{<br />
			//Allow select keys without autocompleting<br />
			switch(e.KeyCode)<br />
			{<br />
				case Keys.Back:<br />
				case Keys.Left:<br />
				case Keys.Right:<br />
				case Keys.Up:<br />
				case Keys.Delete:<br />
				case Keys.Down:<br />
					return;<br />
			}<br />
<br />
			//Get the typed text and find it on the list<br />
			string strTypedText = cbo.Text;<br />
			int intFoundIdx = cbo.FindString(strTypedText);<br />
<br />
			//If we found the typed text in the list then autocomplete<br />
			if(intFoundIdx >= 0)<br />
			{<br />
				//Get the item from the list (Return type depends if datasource was bound<br />
				//or list created)<br />
				object objFoundItem = cbo.Items[intFoundIdx];<br />
<br />
				//Use the listcontrolgetitemtext to resolve the name in case the combo <br />
				//was data bound<br />
				string strFoundText = cbo.GetItemText(objFoundItem);<br />
<br />
				//Append then found text to the typed text to preserve case<br />
				string strAppendText = strFoundText.Substring(strTypedText.Length);<br />
				cbo.Text = strTypedText + strAppendText;<br />
<br />
				//Select the appended text<br />
				cbo.SelectionStart = strTypedText.Length;<br />
				cbo.SelectionLength = strAppendText.Length;<br />
			}<br />
		}<br />
<br />
		private void ACCombo_Leave(ComboBox cbo)<br />
		{<br />
			int intFoundIdx = cbo.FindStringExact(cbo.Text);<br />
			cbo.SelectedIndex = intFoundIdx;<br />
		}<br />


Let me know if you need this for VB.NETSmile | :)

I reject to reality and subsitute my own!
- Adam Savage, Mythbuster

life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
GeneralRe: combobox and auto-completion Pin
gibono8-May-05 23:22
gibono8-May-05 23:22 
Questionhow to bind a richtextbox control's rtf property to the database?? Pin
2-May-05 21:04
suss2-May-05 21:04 
GeneralArchive Mail Reader Pin
Member 21255652-May-05 20:23
Member 21255652-May-05 20:23 
GeneralText Box doesn't show new Value Pin
RobertS.2-May-05 15:53
sussRobertS.2-May-05 15:53 
GeneralRe: Text Box doesn't show new Value Pin
Dan_P2-May-05 16:05
Dan_P2-May-05 16:05 
GeneralUpButton and DownButton methods Pin
JeffHarrold2-May-05 15:52
JeffHarrold2-May-05 15:52 
GeneralRe: UpButton and DownButton methods Pin
JeffHarrold3-May-05 13:11
JeffHarrold3-May-05 13:11 
Generalbrowsing the web from widows application Pin
Modern_night2-May-05 15:29
Modern_night2-May-05 15:29 
GeneralRe: browsing the web from widows application Pin
Christian Graus2-May-05 16:25
protectorChristian Graus2-May-05 16:25 
GeneralRe: browsing the web from widows application Pin
Polis Pilavas3-May-05 3:37
Polis Pilavas3-May-05 3:37 
QuestionPropertyGrid - how to apply changes? Pin
czajajajatoszmaciarz2-May-05 13:04
czajajajatoszmaciarz2-May-05 13:04 
AnswerRe: PropertyGrid - how to apply changes? Pin
Dan_P2-May-05 15:03
Dan_P2-May-05 15:03 
AnswerRe: PropertyGrid - how to apply changes? Pin
Mathew Hall2-May-05 15:03
Mathew Hall2-May-05 15:03 
GeneralRe: PropertyGrid - how to apply changes? Pin
Anonymous3-May-05 10:00
Anonymous3-May-05 10:00 
GeneralRead only Outlookbar Pin
Member 19299502-May-05 12:43
Member 19299502-May-05 12:43 
GeneralRe: Read only Outlookbar Pin
MoustafaS2-May-05 13:14
MoustafaS2-May-05 13:14 
GeneralUrl navigation Pin
Adnan Siddiqi2-May-05 10:42
Adnan Siddiqi2-May-05 10:42 

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.