|
I have a custom collection class that is bound to a PropertyGrid object, which functions very well. Part of the collection class is as follows:
public DotCommand[] Attributes
{
get
{
return attributes;
}
set
{
attributes = value;
if (AttributesChanged != null)
AttributesChanged(this, new EventArgs());
}
}
The PropertyGrid shows the Attributes item, with an ellipsis button (...); when I click on the button the Object Collection Editor appears and I can add items (the DotCommand object is very simple, it just contains two string objects, exposed with public get/set properties). When I dismiss the Object Collection Editor with Ok, the setter for the Attributes property above is not hit. If I press the ellipsis again, only the last added item is displayed (the others are gone).
What do I need to do to wire the PropertyGrid and Attributes property together properly? Is it because the Attributes property is an array (DotCommand[] )?
- Dy
|
|
|
|
|
-Dy wrote: When I dismiss the Object Collection Editor with Ok, the setter for the Attributes property above is not hit.
This is the correct behavior. The Object Collection Editor is not allowing the user to choose which array the property should be set to, but, rather, is allowing the user to modify the contents of the array. The objects in the array are being edited.
-Dy wrote: If I press the ellipsis again, only the last added item is displayed (the others are gone).
This might be due to the fact that the property is an array type. If you were to use an ArrayList instead of an array, does that fix the problem? I imagine it would.
Josh
|
|
|
|
|
I the days of COM we had reference counting, which i beleive probably still exists within .Net in some form or other otherwise the gargabe collector wouldn't be able to do it's job.
I basically want to code a simple but semi intelligent cache, where upon an object being added to the cache it remains there whilst there's more than one reference to it. One of the references being the cach of course. But when only the cache has a reference and maintains that single reference for around say 5 mins, after 5 mins it unloads it. I'd like the cache to manage this without the business object having to know anything about the cache, otherwise I could probably place a call within the business objects dispose() to decrement a reference count of some form.
The reason for this is to create a smart datalayer and reduce the number of trips to the database for certain business objects.
Or is there another way????
Andy
|
|
|
|
|
|
Hi all I am doing a project in C# in which I need to get html,doc,and txt files from the selected directory and leaving the remaining files. now stringpattern argument of GetFiles method only allows us to get one or all type of documents in the directory plz tell me how can i get three types of documents
Regards,
|
|
|
|
|
It's simple !
Call "GetFiles" for each file type.
<br />
string folder = "c:\\";<br />
ArrayList list = new ArrayList();<br />
list.AddRange(Directory.GetFiles(folder, "*.html"));<br />
list.AddRange(Directory.GetFiles(folder, "*.doc"));<br />
list.AddRange(Directory.GetFiles(folder, "*.txt"));<br />
string[] files = (string[])list.ToArray(typeof(string));<br />
Best regards, Alexey.
|
|
|
|
|
thxx brother but i want a technique through which i get all of these documents in one pass. coz if now i tried this i have to change the whole design of my project which is not possible so is there any other way out ??
-- modified at 5:04 Monday 8th May, 2006
|
|
|
|
|
Rizwan Rathore wrote: i want a technique through which i get all of these documents in one pass.
Wrap it in a method...
|
|
|
|
|
hi all
codeproject is best
i want connect to access db programmatically but .. i will not successfull .. finally i done this operation and i found my problem . that is Dataset object that when i create dataset programmatically ,
i can't connect to db, and when i drog and drop dataset object in design time and specify parameters (like columns,type of it's,...) my program connect to database . how to solve my problem that i create dataset programmatically and my program connect to db ???
please give me a full example with source and db hase password ...
thanks..
codeproject is best ..
|
|
|
|
|
Creating a DataSet at runtime or at "design time" (which really just means that VS writes the code for you - it's still created at runtime) has absolutely no relevance as to whether an application can connect to a database. My guess is that whatever you're doing at design-time is causing your db connection information to be generated as well. If you want a
hdv212 wrote: full example with source and db hase password
then just check out the code that Visual Studio writes for you after you drag and drop a DataSet onto the Form.
Please, don't ever ask for a full source code example. We have our own jobs.
Josh
|
|
|
|
|
i need a program which can give information like
CPU type,cpu utilization, maximum application address, minimum application address, available page file,available physical memory, available virtual memory, size of structur, memory in use,total page size, total physical memory.
|
|
|
|
|
Go this url and find your api :
http://www.pinvoke.net
|
|
|
|
|
In the TAPI3_0 Application Development with C# sample posted here there is an error "compobj.dll is too old for the ole2.dll initialized " when i am trying to call through the modem(Voice Modem).
Are there any solutions for this?
|
|
|
|
|
hi friends,
I have few queries in C#:
1)how to call javascript function from c# function
2)how to pass string arrays from c# function to javascript
and viceversa
3)how to pass arraylist from c# function to javascript
and viceversa
Please help me out...Expecting your reply...
Thanks
|
|
|
|
|
You did not provide any information pertaining to the hosting process and context for the C# code and the scripting engine. Without that I don't know if anyone would be able to help.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
hi mike,
Thanks for your reply.
I have no. of image filenames in sql database.Using C#, I extracted that data and stored in arraylist.Now I want to store this arraylist object in javascript array.
Is it possible? If yes, please send me sample example.
Thanks
test
|
|
|
|
|
foreach (string name in mylist)
{
Page.RegisterArrayDeclaration("listname", name);
} This will emit the following:
var listname = new Array('a','b','c','d',....);
|
|
|
|
|
hi leppie,
Thanks for your reply.
C# code:
ArrayList c_list = new ArrayList();
c_list.Add("d");
c_list.Add("e");
c_list.Add("f");
Javascript code:
var js_list = new Array('a','b','c');
Now I want to know how to transfer arraylist values from C# to javascript(i.e., c_list -> js_list)
Source -> Destination
C# -> javascript
Please help me to sort out this problem
Thanks
|
|
|
|
|
tjpraveen23 wrote: Javascript code:
var js_list = new Array('a','b','c');
you dont have to declare that. reread my post and try it out.
|
|
|
|
|
Hi! I need code of snakes and ladders game in visual C.Net..plz if any one can help me in this game. Plz if u have the compied and debugged code of this game ..kindly send it to me on the following ID
"spoiledpunk143@gmail.com"
If there r any kinda errors in it..even then its Ok ..i'll try to debug them..but kindly send the game code.
wasif naeem
|
|
|
|
|
Why don't you try and write the game youself? If you run in to problems then we can help you.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I have the following callback function which I am using to update a progress bar. The only problem is, when I change the value of the progress bar, the bar doesnt change It just shoots to 100 when it is done. I have tried using Application.DoEvents(); .
private Int32 CopyInProgress(uint TotalFileSize, uint BytesTransfered, uint StreamSize, uint StreamBytesTransfered, uint DwStreamNumber, long dwCallbackReason, long hSourceFile, long hDestinationFile, long lpData)
{
float t = TotalFileSize;
float bt = StreamSize;
int nPercent = (int)(bt/t)* 100;
percentComp.Text = nPercent.ToString() + "%";
progressBar.Value = nPercent;
Application.DoEvents();
return PROGRESS_CONTINUE;
}
Any ideas why this is happening?
Sean
|
|
|
|
|
Yup, I got an idea.
You are converting a float (bt/t) into an int...then multiplying it by 100.
By definition, when you make it an int in this manner the answer can only be 0 or 100 and nothing in between.
try changing it to:
int nPercent = (int)(bt/t*100);
|
|
|
|
|
Nicely spotted! I was trying to find a reason why the message couldn't have reached the control. Tuh!
Regards,
Rob Philpott.
|
|
|
|
|
Not a problem. Even a crusty old C programmer gets to get one right once in a while.
The rest of the time I'm generally walking around C# and .NET like a complete idiot because so many of the rules have been changed that there's not a lot of advantage to having programmed for 20+ years...LOL.
Score:
Cprogrammers = 1;
WhizKids = INT_MAX;
|
|
|
|