|
In the particular immediate case, I'm thinking about a control that's somewhat like an enhanced ListBox which allows for the possibility of a list item changing height. When the width of the control is changed, its items get a chance to redetermine their height. My plan is to do this first for the items on the screen, and then for everything else; all items would have to be measured to set the scroll bar accurately, but I wouldn't want to hold up the entire UI thread for that.
If the control were an opaque class, it might make sense for the measurement to be done in a background thread. Since it is not, however, it would seem like very poor style to have a background thread call the list contents' measure-item methods which may not be expecting invocation outside the UI thread.
|
|
|
|
|
At worst, you could call Application.DoEvents to run any pending UI operations. Beware of issues like reentrancy though.
|
|
|
|
|
I suppose Application.DoEvents might not be totally evil in that circumstance; maintain a flag to ignore recursive calls and the rest of the UI should be able to function while the updates are completed. It would be nicer if there were a version of Application.DoEvents that would only handle certain events while ignoring others, but I don't know of any such beast.
|
|
|
|
|
I'm doing a C#/.NET home project, and need - from within C# code - to access some sort of dictionary database. The ONLY requirement is to test if arbitrary strings match to real words or not - I do NOT need any of the other dictionary or spell checker stuff, such as alternative-word-suggestions, nor word meanings ... just is the string in the dictionary or not. Not sure about plurals though?!
This is an educational exercise, so I'm definitely hoping for some kind of freebie.
If anyone's got any got ideas I'd be very grateful ... thanks.
|
|
|
|
|
If the idea is not in database usage, you could look at DataTable and DataSet and it's serializing capabilities (along with other features).
|
|
|
|
|
Many thanks. What I'm really trying to fathom is:-
1) Where do I get the dictionary info from in the first place. I need something someone else has already created - I don't have the knowledge to try creating dictionaries from scratch.
2) I need it in a form such that I can interrogate it programmatically. I want to present an arbitary string to it (from within C# code) and get it to return a value indicating if the string matches a known word or not - nothing more.
3) I would need the dictionary to recognise both singular and plural forms.
Best regards,
|
|
|
|
|
|
Excellent - your Google search was much better than mine! And yes, the storage format will have a big impact on the search time - some sort of successive approximation approach seems likely.
Thanks
|
|
|
|
|
|
This sort of thing has come up before and I don't remember what site the asker was directed to.
I wrote my own such thing a few years ago as a Scrabble aid. I got an enormous list of words* from a Scrabble website and imported them to an Access database.
* Actually two lists; one is 2.3MB, the other is 1.6MB and seems to be missing the non-kid-sister-friendly words.
Where shall I send them?
|
|
|
|
|
Here's[^] a link to the message I remember.
|
|
|
|
|
|
Take a look at the Hashset< string>. It should work at an acceptable pace for this requirement (and I'd like to know if it doesn't). Just load it in from a file when you start your app, and use .Contains(...).
|
|
|
|
|
If it weren't for my elderly PC setup I'd give this a go, but I'm running with Win2K Pro which means I cannot install .NET 3.5. But I think you've pointed me in the right direction regards implementation - a hash table looks a good approach to explore. Thanks. And I suppose one of these days I'd better stump up some cash and upgrade my PC?!
|
|
|
|
|
Do you have 2.0? Iesi.Collections contains a HashedSet< T> which is functionally very similar.
|
|
|
|
|
.NET 2.0 SP1 ... but no Iesi. Is Iesi a 3rd party library I need to install? And if so can you suggest a reliable source please.
Aha! ... NHibernate.org - is that it?
modified on Tuesday, January 27, 2009 6:25 AM
|
|
|
|
|
Yup the NHibernate chaps maintain Iesi iirc. Nhibernate distro, or even grab their source.
|
|
|
|
|
Are we talking NHibernate 2.0.0.Beta1 here? I can't see a release-version binary. I'd prefer to only download the binary ... is this Beta pretty stable do you know?
OK - I can see my mistake. I followed the Download link in the left-hand menu, rather then the direct link right in front of me. The download link doesn't show the release version!
modified on Tuesday, January 27, 2009 7:47 AM
|
|
|
|
|
Any of the above. Iesi is pretty stable, I doubt its changed much since the initial release. Diamond Binding has a known good version in the release (as we use NHibernate). Link in sig.
|
|
|
|
|
We crossed in the post. Thanks. See my edit to previous post.
|
|
|
|
|
Sorry, one more question. Now I've downloaded it - how do I install it?!
|
|
|
|
|
DB you can just install, the assembly will be in here Program Files\D&C\DB\Runtime\Assembly and in the GAC. I'm not sure where NHibernate puts things off the top of my head.
If you've run an NH installer, then I guess check the GAC and the NH install directory. Its a pain to get stuff out the GAC as well - and VS doesn't enumerate the GAC for references which is quite annoying.
I think Iesi.Collections originated on code project.. yeah onenote tells me it came from here: http://www.codeproject.com/csharp/sets.asp#xx703510xx. Might be easier to grab the original.
|
|
|
|
|
Hi,
I am trying to implement a progress bar (derived from the standard Windows.Forms.ProgressBar) which allows you to set to Marquee mode and then start and stop the animation. I have solved most of the problems, but when I stop the animation by setting the MarqueeAnimationSpeed to zero, the blocks on the bar remain visible, which is not what I want.
The only other way I can think of to stop the animation is to change the style of the progress bar to not be Marquee and then put it back again when I want to start the animation. The problem here is that the animation does not restart.
I could override the OnPaint() and do my own animation but I am reluctant to do this because it would require some work to make the progress bar look like a standard progress bar, respecting all the property settings on the original Forms.ProgressBar.
There must be a way to get a Marquee to start and stop.
Any help or ideas to try would be very gratefully received.
Best wishes, Patrick
|
|
|
|
|
Hi,
i have an application (fw 2.0) with a ListView in details mode. Some of the ListViewItems have different values for ForeColor and BackColor. Running the application local, all looks fine. The ListViewItems appear with the given values for BackColor and ForeColor. Problem: When i start the app by using a terminal session (Windows Server 2003 with Citrix) the BackColor and ForeColor attributes of the ListViewItems are ignored. What can I do? I don't want to override OnDrawItem, OnDrawColumnHeader and OnDrawSubItems to solve this problem.
Thanks for any hint.
Ralph
|
|
|
|
|
heres my code, dont know what the error is all about,: can someone help me.
Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
Dim int As Integer
Dim str As String
Dim colname As String
Dim col As Integer
Try
col = DataGridView1.ColumnCount
For int = 6 To col
colname = DataGridView1.Columns(int).Name
str = (colname.Substring(0, 3))
Dim i As Integer = 0
If str = "qrs" Then
For i = 0 To 10
qrs(i) = DataGridView1.CurrentRow.Cells(int).Value
totalqrs = totalqrs + qrs(i)
Next i
ElseIf str = "ars" Then
For i = 0 To 10
ars(i) = DataGridView1.CurrentRow.Cells(int).Value
totalars = totalars + ars(i)
Next i
ElseIf str = "prs" Then
For i = 0 To 10
prs(i) = DataGridView1.CurrentRow.Cells(int).Value
totalprs = totalprs + prs(i)
Next i
ElseIf str = "qps" Then
For i = 0 To 10
qps(i) = DataGridView1.CurrentRow.Cells(int).Value
totalqps = totalqps + qps(i)
Next i
ElseIf str = "aps" Then
For i = 0 To 10
aps(i) = DataGridView1.CurrentRow.Cells(int).Value
totalaps = totalaps + aps(i)
Next i
ElseIf str = "pps" Then
For i = 0 To 10
pps(i) = DataGridView1.CurrentRow.Cells(int).Value
totalpps = totalpps + pps(i)
Next i
ElseIf str = "qpe" Then
qper = DataGridView1.CurrentRow.Cells(int).Value
qper1 = qper / 100
ElseIf str = "ape" Then
aper = DataGridView1.CurrentRow.Cells(int).Value
aper1 = qper / 100
ElseIf str = "ppe" Then
pper = DataGridView1.CurrentRow.Cells(int).Value
pper1 = qper / 100
ElseIf str = "per" Then
PERS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "mer" Then
MERS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "pfr" Then
PFERS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "fer" Then
FERS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "pep" Then
PEPS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "mep" Then
MEPS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "pfp" Then
PFEPS = DataGridView1.CurrentRow.Cells(int).Value
ElseIf str = "fep" Then
FEPS = DataGridView1.CurrentRow.Cells(int).Value
Else
MsgBox(" nothing to compute")
End If
Next int
WQ = ((totalqrs / totalqps) * 100) * qper1
WA = ((totalars / totalaps) * 100) * aper1
WP = ((totalprs / totalpps) * 100) * pper1
CS = Math.Round((WQ + WA + WP), 2)
WCS = Math.Round((CS * 0.4), 2)
'Preliminary
WPE = ((PERS / PEPS) * 100) * (0.1)
'Midterm
WME = ((MERS / MEPS) * 100) * (0.2)
'Pre-Final
WPFE = ((PFERS / PFEPS) * 100) * (0.1)
'Final
WFE = ((FERS / FEPS) * 100) * (0.2)
CFRS = Math.Round((WCS + WPE + WME + WPFE + WFE), 0)
'Display Weighted Exam Scores
Information.txtWPre.Text = Math.Round(WPE, 2)
Information.txtWMid.Text = Math.Round(WME, 2)
Information.txtWPf.Text = Math.Round(WPFE, 2)
Information.txtWFin.Text = Math.Round(WFE, 2)
'Display CS/CFRS
Information.lblcfrs.Text = CFRS
txtcfrs.Text = CFRS
txtCs.Text = CS
Catch ex As Exception
MsgBox(ex.Message)
End Try
it seems that the conditions arent tested, it proceeds to the "else" value..
then the error of index out of range follows..
|
|
|
|