|
I can't seem to find a solution for this (and it's probably very simple)
Situation:
I have a combobox with a list(of string) as datasource
I've put the autocompletmode to append and the autocompletesource to listitems
everything works fine untill here
problem:
my users has to be able to type into the combobox but only text that is in the list
this works with a bit of code (check to see if there is text in the textpart of the combobox, if so check the list, if the list contains the text go on else clear combobox and start over)
but now when I start typing a word that is in the list the combobox appends the rest of the word (exactly like I want it) the only problem is that if I don't type the word out full the text that needs to be appended is not appended. The combobox only does this when I hit enter (this is not an option since the combobox is on a dialogwindow and hitting enter is accepting)
question:
anyone know how I can force the combobox to append the text when I leave the combobox (with tab)?
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
You could consider mimicking the combobox's behavior, in the leave event. If you do it with a little function, you would even be able to reuse it with other comboboxes.
Combob1.Text = YourLittleFunction(Combob1, Combob1.Text)
or
Combob1.SelectedItem = YourLittleFunction(Combob1, Combob1.Text)
and
Public Function YourLittleFunction(Byval combob as ComboBox, Byval TypedSoFar as String) as String<br />
'loop through the items in combob, and compare them with TypedSoFar.<br />
'Which ever comes closest is the winner.<br />
Return the winner<br />
End Function
Or something along those lines...
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
thanks for the reply
turned out I was able to do it very simpel with the code already in the leave event (the code that check wheter or not the text exists in the list) apperently the text that is apended is already in the .text property the only problem I had was that its case sensitive and the text in the list was uppercase and the text entered lowercase.
but you're post did help me with forming an idee of what was going on so thanks...
just in case you are wondering how I did it here is the code:
If cboType.SelectedItem = Nothing And Not cboType.Text.Equals("") Then
Dim l As New List(Of String)
For Each s As String In cboType.DataSource
l.Add(s.ToLower)
Next
If l.Contains(cboType.Text.ToLower) Then
cboType.SelectedItem = cboType.Text
Else
cboType.Text = ""
cboType.Focus()
End If
End If
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Hello!
I have a rich text box with multiple lines. I can count number of lines but cannot find a line with maximum number of chracters.
Thanks for Any help.
colgateas900197
|
|
|
|
|
RichTextBox.Lines
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: RichTextBox.Lines
Doesn't that just tell how many lines are in the control? Sounds like the OP wants the line with the most characters in it
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
public string[] Lines { get; set; }
tells a lot, including the number of lines, and with a simple loop also the length of
the longest/shortest/whatever line.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: with a simple loop also the length of
the longest/shortest/whatever line
I figured once one grabs the info from Lines , they could pretty much do whatever at that point
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello all, this is my first posting in codeproject. Does anyone know how to make mp3 playlist like winamp playlist... Need help... >_< The concept is just the same as winamp, we can add song with the add button, then the song will appear in the list. Some forum said that I should use datagrid component in vb.net, but I don't know what to do with that thing. Don't know how to add data to the datagrid, etc. lol. I still don't know how to use MSDN help. T-T Heeeeelllp...
- No Signature Available -
|
|
|
|
|
it depends on the format you want, but if you want to use the universal .m3u playlist format read and learn something about collections but just use these codes...its a real bad programming practice, not that, but it works
Dim sr As IO.StreamWriter = IO.File.CreateText(Application.StartupPath & "\Playlists\" + TextBox1.Text + ".m3u")
sr.WriteLine("#EXTM3U")
lstItems = ListView1.Items.Count - 1
For i = 0 To lstItems
'ext = System.IO.Path.GetExtension(CStr(ListView1.Items(i).SubItems(0).Text))
'w = CStr(ListView1.Items(i).SubItems(0).Text + ext)
sr.WriteLine(CStr(ListView1.Items(i).SubItems(1).Text))
Next
sr.Close()
sr = Nothing
w = Nothing
do u understand the codes...i used directx to do a music player and a dj soft
try this out
phatkin
|
|
|
|
|
create a txt file with the format .m3u
the write the first line as
sr.WriteLine("#EXTM3U")
then write the location of all the songs in the playlist
the save it..u can even open with VLC or windows media player
but its a real bad practise so go and read on collections
phatkin
|
|
|
|
|
Hi. I'm trying to access the windows forms generated code to change the connection strings so that they are not hard coded. I'm using an access database. Please let me know how to access the windows forms generated code in vb.net 2005.
Mr Oizo
|
|
|
|
|
next to the Form in the solution explorer there should be a '+'.
Click it and spot the file called *.designer.cs
|
|
|
|
|
Thanks. I didn't see that coz I needed to click "show all files" anyways now I gotta hunt down the connection string dat source.
Mr Oizo
|
|
|
|
|
May I add that it is generally not a good idea to change generated code since changes you make in the designer could change the generated code. Do this with caution
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks man. I fell really stupid now....Didn't click "show all files" so i didn't know it was there
|
|
|
|
|
I don't have to click "Show All Files" :S but I am using C# so maybe it's different for the C# VS layout or for C# projects.
|
|
|
|
|
hi everyone,
can anybody tell me that how can i play or run a AVI file using vb.net ?
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
If you'd googled it, every exampe you'd have found would be using the windows media player control, except for the one or two that used managed directX
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yeah, using managed DirectX fully
i did a media player using managed directX but had to install a third party codec as part of the installation process, to play the avi files.
u can try this if u dont have any other option.
phatkin
|
|
|
|
|
This is only because your AVIs used this codec, and would be the same no matter what you used. If you used avi without a foreign codec, or MPG or WMV, then it would just work
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
hai,
i want to draw a backgroun image on a resizable form. i tried Paint Form_Paint event as follows
e.Graphics.DrawImage( hImage , 0 , 0 , Me.width , Me.height )
this draws only at the updated portion of the window and the previous drawing remains the same, hwo can i draw image on entire window
|
|
|
|
|
before drawing clear the graphics
Me.CreateGraphics.Clear(Me.BackColor)
then redraw the background image
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
thanks its works !
but i think i should use Me.CreateGraphics.DrawImage(h, 0, 0, Me.Width, Me.Height) instead of PaintEventArgs
|
|
|
|