|
Why don't you just do this:
clbFormats.SetItemChecked(cblFormats.SelectedIndex, chkUpdate.Checked);
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks for the suggestion, unfortunately that won't work.
The CheckedListBox-items and the CheckBox are independent, but for each ListBox-item I need to remember whether the CheckBox was checked when that item was selected.
That's why I need to be able to update the Data associated with each ListBox-item.
|
|
|
|
|
I truly dislike wasting my time.
When you ask a question here, clearly state all of your requirements in your original message. Finding the answer you want will require at least 30 minutes. Of course, you're a programmer too (or maybe not), and that's how long it should take YOU to work this out on your own.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello everyone,
Here is my understanding of pros and cons SortedDictionary v.s. Dictionary, am I correct? Or anything important missing? What is your practices of when to use SortedDictionary and when to use Dictionary?
1. Dictionary is faster for insertion and removal, but slower for query value by key compared with SortedDictionary;
2. Dictionary is using a linear array to store key/value pair, but SortedDictionary is using binary search tree to store key/value pair, so for query, SortedDictionary is faster.
thanks in advance,
George
|
|
|
|
|
George_George wrote: 1. Dictionary is faster for insertion and removal, but slower for query value by key compared with SortedDictionary;
Lookups should be the same, both O(1).
George_George wrote: 2. Dictionary is using a linear array to store key/value pair,
But this is store in a special order, determined by the hash value of the key. If indeed the SortedDictionay is using a BST, it will be slower for lookups as it will by O(log n).
|
|
|
|
|
Thanks leppie!
I agree. Looks like lookup operation in Dictionary is faster than SortedDictionary, here are some further documents I found. Do you think they support your conclusion?
Mentioned here,
http://msdn.microsoft.com/en-us/library/xfhwa508(VS.80).aspx
"Retrieving a value by using its key is very fast, close to O(1), because the Dictionary class is implemented as a hash table." Looks like the query time for Dictionary is O(1), but the query time for SortedDictionary is O(logn) -- "The SortedDictionary generic class is a binary search tree with O(log n) retrieval, where n is the number of elements in the dictionary. In this respect, it is similar to the SortedList generic class. The two classes have similar object models, and both have O(log n) retrieval. Where the two classes differ is in memory use and speed of insertion and removal."
http://msdn.microsoft.com/en-us/library/f7fta44c(VS.80).aspx
regards,
George
|
|
|
|
|
Hello,
It's been a couple of days now that I've been searching for how to instantiate a certificate store FROM A FILE. X509Store class doesen't have any suitable members. Is it possible at all?
Thank you,
komadich
|
|
|
|
|
Can you provide some more details that what else you wanna do?
X509Certificate class is used to read a certificate like:
X509Certificate cert = X509Certificate.CreateFromCertFile(PathToCertificate);
If you have a certificate file with extension .cer you can read it's contents through the object of X509Certificate.
MakeCert is a utility with .Net Framework to create a Certificate.
There are other encryption libraries available that you can use to provide a private/public key pair for creating your certificate....?
Whereas the X509Store is used to manage the certificates...
Muhammad Talha
|
|
|
|
|
Hello,
VS 2008 3.5.Net
I am getting a string from a call back in a C++ native DLL which I have written. And for some reason it displays wrong something like this. i.e. [][[[[[[[[[[[[[ or ????????????????? with ASCII encoding.
My code is below. I think the DLL is using unicode, and I am trying to encode it in ASCII. The parameter in call back definition is char*. And in my C# I am using a string.
I have also tried Unicode, UTF-8, and ASCII. All of them display incorrectly.
Am I doing something wrong with my code?
Many thanks for any suggestions,
<br />
*.hpp file ==============<br />
typedef int (__stdcall *ptrIncomingCall)(int callID, char *caller);<br />
MOBILEDLL_API int drvIncomingCall(ptrIncomingCall cb);<br />
<br />
*.cpp file ==============<br />
int drvIncomingCall(ptrIncomingCall cb)<br />
{<br />
int callerID = cb(20, "Joe bloggs");<br />
<br />
return callerID;<br />
}<br />
<br />
C# code ===============<br />
private delegate int incomingCallDelegate(int callerID, string caller);<br />
[DllImport("MobileDLL.dll")]<br />
static extern int drvIncomingCall(incomingCallDelegate cb);<br />
<br />
int OnIncomingCall(int callerID, string caller)<br />
{<br />
ASCIIEncoding encoding = new ASCIIEncoding();<br />
byte[] callerBytes = encoding.GetBytes(caller);<br />
<br />
this.label1.Text = callerID.ToString();<br />
this.label2.Text = encoding.GetString(callerBytes, 0, callerBytes.Length);<br />
<br />
return 1;<br />
}<br />
<br />
private void button4_Click(object sender, EventArgs e)<br />
{<br />
drvIncomingCall((incomingCallDelegate)OnIncomingCall); <br />
}<br />
|
|
|
|
|
private delegate int incomingCallDelegate(int callerID, [MarshalAs(UnmanagedType.LPStr)] string caller);
int OnIncomingCall(int callerID, [MarshalAs(UnmanagedType.LPStr)] string caller)
I think this should work..
|
|
|
|
|
Hello,
Thanks for your response.
However, I have tried to get that to work. See code below. I am getting a run-time error: "NotSupportException was unhandled" Error No. 0x80131515
Stack Trace:
at MobileApp.Form1.button4_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
at System.Windows.Forms.Application.Run(Form fm)
at MobileApp.Program.Main()
private delegate int incomingCallDelegate(int callerID,[MarshalAs(UnmanagedType.LPStr)] string caller);<br />
[DllImport("MobileDLL.dll")]<br />
static extern int drvIncomingCall(incomingCallDelegate cb);<br />
<br />
int OnIncomingCall(int callerID,[MarshalAs(UnmanagedType.LPStr)] string caller)<br />
{<br />
ASCIIEncoding encoding = new ASCIIEncoding();<br />
byte[] callerBytes = encoding.GetBytes(caller);<br />
<br />
this.label1.Text = callerID.ToString();<br />
this.label2.Text = encoding.GetString(callerBytes, 0, callerBytes.Length);<br />
<br />
return 1;<br />
}<br />
<br />
private void button4_Click(object sender, EventArgs e)<br />
{<br />
drvIncomingCall((incomingCallDelegate)OnIncomingCall); <br />
}
|
|
|
|
|
I am not sure why this would happen.
rather than using marshall you could try use StringBuilder instead of string..
|
|
|
|
|
Hello,
Thanks for your patiance with this question.
This is what I have tried.
I have tried to use the Encoding class. I have tried ANSII, UTF-8, Unicode, and default. Default was the first one I tried.
I have also tried the char sets as well, auto, ASCII, etc.
I have also tried using the stringbuilder instead of string. Failed also.
Many thanks for any more suggestions,
Steve
|
|
|
|
|
Hi
i need one help . i want to upload all files from one folder( in client side) to server without browse option . we will give path of the folder (constant).
|
|
|
|
|
Then you either need to start a program on the client computer, or a component (ActiveX control/Java applet/Silverlight) in the browser.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i want to upload all files from one folder( in client side) to server at button click event of that page without browse option(without file uploader) . we will give path of the folder path (constant)
|
|
|
|
|
Ok, I can put it another way:
That's not possible.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all,
Any one suggest me how to remove Zero in the first place. For eg : 0208 in this I want to remove the zero only in the first occurance, therfore the output should be like 208. how to achive this using reguler expression? Because i need a solution using reguler expression
Also the length should be only 4.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
Hi all,
Sorry for this post. I found the solution. Please tell me is this a correct solution
Regex regex = new Regex(@"\d{4}", RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
string result="";
if (regex.IsMatch("00585"))
{
regex = new Regex(@"^0*");
result= regex.Replace("000508050", @"");
}
OutPut: 508050
Know is Drop, Unknown is Ocean
|
|
|
|
|
hi just for suggestion.. you can actually check the regex syntax by using another software such as regexbuddy
|
|
|
|
|
i create multithread about 100 thread to read text file base
and load data is match regulare expresstion but sometime result about
5000 answer sometime result about 7000 not reliability how to program this?
|
|
|
|
|
This is due to data collision.. you could try ReaderWriterLock class, monitor lock , Synchronization Locks
|
|
|
|
|
Hi! I have a question, I have a WIN app, and I am loading an xml document within that form. Then I have another form, what I can reach with pressing a button on the first form. I have there few fields, what I need to fill in, and I want to gather the data from the XML document what is loaded in the previous form. Is that possible?? Thx
|
|
|
|
|
You should create a Static class with static variables in it, and then create a method to load data from xml file to variables available in this static class let call it MyLoad() function.
Call this MyLoad function from the first form and load xml file in this static class. Now you may access and share data from both of the forms using this static class.
You may directly access variables of this class without any object such as-
MyStaticClass.Variable1=”Some Value”;
I hope this helps .
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
i have stored procedure from SQL have bit parameter returns 1 or 0,
the parameter works fine on SQL
on C# i have problems, as the following:
SqlCommand checkDone = new SqlCommand();
checkDone.Connection = con1;
checkDone.CommandType = CommandType.Text;
checkDone.CommandText = "checkCompatability";
SqlParameter complete = new SqlParameter("@award_num", SqlDbType.Int);
complete.Direction = ParameterDirection.Output;
complete.Value = int.Parse(comboAwardNum.Text);
SqlParameter comp = new SqlParameter("@compatability", SqlDbType.Bit);
comp.Direction = ParameterDirection.Output;
bool mybool=bool.Parse(comp.Value).ToString();//error here
lblresult.Text = comp.Value;
checkDone.Parameters.Add(complete);
checkDone.Parameters.Add(comp);
checkDone.Connection.Open();
checkDone.ExecuteScalar();
checkDone.Connection.Close();
how to return parameter value from SQL?
thanks
|
|
|
|