|
I still fail to see the point of a resx file except for embeded resources (but direct embedding is better anyways) and for i18n. Normally they just contain a bunch of needless overhead.
|
|
|
|
|
hi all
How can i access soap protocal over the internet
Let say i am using web service
I want someone to help me
I need pdfs and code sample or site
-- modified at 11:45 Monday 20th February, 2006
|
|
|
|
|
Hello everyone:
I need to use a collection technique but I am not sure which one will be best for my situation.
I have relational data that I need to store; I have a table that has Keys and another table has values, each KEY may contain mulitple values. Both KEY and VALUE are string, can you suggest me which (NameValueCollection or HashTable) I should use?
Thanks a lot.
|
|
|
|
|
The tables that you are talking about, are they database tables?
In what way can the key contain multiple values?
---
b { font-weight: normal; }
|
|
|
|
|
I'm a newbie so take my advice with a grain of salt, but it seems like NameValueCollection was designed with exactly that in mind. The alternative would be a HashTable with arrays of strings for the values, but NameValueCollection takes care of some of the dirty work there -- although it does get a little messy when you only want to access one of the many values stored under a key.
That will be $0.02 please. Cash or charge?
|
|
|
|
|
They are both the same.
For the value bit you simple need to use another Hashtable or ArrayList. Seems tricky at 1st due to the extra casting, but once u write a few of them its like writing a for loop :p
|
|
|
|
|
Ok,
Here's a design question that has me stumped. Let's say I have a windows forms application that is sitting on top of a business layer, that sits on top of a database. Now, let's say that a particular object may be accessed by multiple views in the system at the same time. Instead of creating a new instance of the object for each view (which means that they will get out of sync), I'd like to have a single instance of the object be used in both places. This is easily done because my business object controller class (that actually instantiates the objects) can keep a lookup table that tracks instantiated objects and indexes them by their unique id (the one from the database). However, this breaks down over time, as the business object controller class never releases the reference to the object (which may be quite large in some cases). Basically, what I need is some sort of reference counting scheme that will actually work.
I suspect that something like this is probably already built into the framework, but I haven't found it yet. Any ideas? Or am I approaching the design from the wrong angle...?
Thanks,
Will Gant
|
|
|
|
|
gantww wrote: Instead of creating a new instance of the object for each view (which means that they will get out of sync)
Why can't they get out of sync? Are you planning to keep the views in sync at all times? So for example, when view 1 changes, view 2, 3, etc. will immediately know about it and refresh themselves. Is that the plan?
I just want to get an idea of how imperative it is for you to keep everything syncronized. Often times we end up spending a lot of time solving a problem that we later realize didn't really need solving.
Regards,
Alvaro
... now you see that evil will always triumph, because good is dumb. - Dark Helmet
|
|
|
|
|
It is imperative to keep everything synchronized, but it may be possible in many cases for me to get away with simple refreshes when the focus changes. However, there are some cases when there may be sidebars or toolbars out that are accessing the same information. They may not get focus, but they still need to be updated to keep the user interface current. If I can make sure both views are actually pointing to the same object, keeping them in sync can easily be done via simple events.
I guess the real issue is figuring out some way to manage the lifecycle of the objects. It would be pretty easy to keep a running list of objects that I have instantiated (since I'm using a factory pattern) and simply return a reference to them if a similar request is made. I could possibly keep the reference to the view that requested them as well. When the object being referenced by the view changes (or the view is disposed), it could inform the class factory that it no longer needs the object. If the object isn't being referenced elsewhere, then it can be released.
The other option would be for the business object itself to allow the registration of objects that are "interested" in it. The object would fire events when a view was added or removed. The individual views wouldn't care about these events, but the class factory for the object would use them to determine whether or not to release the reference to the object. I don't particularly care for this idea, since it puts some lifecycle management logic into the object itself, while the rest of it remains in the controller/factory class.
Any thoughts?
|
|
|
|
|
I'd go with your first idea, which I would implement something like this:
1. Create an interface, such as:
interface IMyObjectUser
{
event EventHandler Disposing;
} 2. I'd have all my users (Views, in your case) implement this interface to raise the Disposing event whenever they call Dispose.
3. I'd pass an IMyObjectUser object to the constructor of your object (or the factory, in your case). In there, I would subscribe to the Disposing event and then store the object inside an ArrayList.
4. Inside the Disposing handler I would locate the object (View) inside the ArrayList and remove it from the list. If the list's Count reaches 0, I would know that no one else is referencing my object and proceed accordingly.
Regards,
Alvaro
... now you see that evil will always triumph, because good is dumb. - Dark Helmet
|
|
|
|
|
Cool. That seems to work well in my proof-of-concept app. Now I just have to move the idea into the real one.
Thanks,
Will
|
|
|
|
|
hi all !
i want to when i press "Esc" key , myForm is closed . how can it possible ?
thanks !
s_mostafa_h
|
|
|
|
|
Subscribe to the Form.KeyUp event (Judah is watching me ):
this.KeyUp += new KeyEventHandler(this.OnKeyUp);
and add this code:
private void OnKeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Escape)
Close();
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: Judah is watching me
With an eagle's eye!
|
|
|
|
|
Hunh?!? Me also read thread. Me come from Delphi background. Pound rock all day. Am tired. What am 'subscribe to the Form.KeyUp event'? How subscribe?
IOW, I've got a Form1 and an AboutBox1 form in my learning project. The AboutBox1 form has a very visible Close button. In Delphi I'd just stick this line of code in the Close button's Click event:
Self.Close;
What's all this subscribe nonsense?
Derek
|
|
|
|
|
If your form has a Close or Cancel button, you can simply set the form's CancelButton property to that control. You can do it via the Designer.
Regards,
Alvaro
... now you see that evil will always triumph, because good is dumb. - Dark Helmet
|
|
|
|
|
HI !
do you tested it ?
but it didn't work ?
by the way , I have no control button in my form .
REGARDS ,
s_mostafa_h
|
|
|
|
|
Hi!
Yes I tested it!
And it did work!
Let me repeat what I said:
If your form has a Close or Cancel button, you can simply set the form's CancelButton property to that control. You can do it via the Designer.
Regards,
Alvaro
... now you see that evil will always triumph, because good is dumb. - Dark Helmet
|
|
|
|
|
Apparently i have to put a button in my form (but i don't want to do it ).
Regrards !
s_mostafa_h
|
|
|
|
|
I am working on a project developing a computer system for a non-profit. It has been decided by the project team that we would develop a menuing system that more or less tells the user what their options are at all times depending on what part of the system they are in. The menu is divided into 7 different categories and has an icon based menu system. The idea is that when one of those categories is selected all forms that are associated to that category are lined up in a menu on the left hand side of the screen.
Example - Icon 2 Selected
{ Icon Button 1 } { Icon Button 2 } { Icon Button 3 } { Icon Button 4 }
Icon Button 2
Menu Option 1
Menu Option 2__________________WORK AREA - FORMS POP UP HERE
Menu Option 3
Example - Icon 4 Selected
{ Icon Button 1 } { Icon Button 2 } { Icon Button 3 } { Icon Button 4 }
Icon Button 4
Menu Option 1
Menu Option 2__________________WORK AREA - FORMS POP UP HERE
Menu Option 3
Menu Option 4
Anyone ever coded something like this in C# before??? Please Help.
-- modified at 10:51 Monday 20th February, 2006
|
|
|
|
|
I found a convertion of C++ Struct into Class (I forgot where i found it). But then I try to convert a C++ Struct (not same code as i found) for Windows API parameters. But it came out an error that said "Incorrect Parameters".
So when we can convert the C++ Struct into Class and when just convert it into C# Struct ?
Thanks.
Simple mind programmers, I don't need a complicated mind.
|
|
|
|
|
Why do you want to convert a structure into a class? That won't work for C++ interop. You can add a struct as a field in a class. You can also create a class with the same fields as a struct. But you cannot, at runtime, convert a struct to a class.
|
|
|
|
|
Hello,
I have a DataGridView, and one of the columns is ComboBox. I have a collection of items that is a datasource for the ComboBox column. The question is:
If a user selects one of the dropdown items from a ComboBox in one record, then that item from a drop down list in ComboBox will be no longer available in the other records. Do I have to create a custom event to do that (hide the item that is selected already in other row)?
Thank you.
|
|
|
|
|
Hi zaboboa,
Here, one thing you should understand that you have given the DataSource to that particular Column not for a row, so what ever the data is available in that DataSource field will displayed in all the Comboboxes of that Column.
The best solution for your problem is to validate the Data in the SelectedIndexChanged Event.
All the best,
Srinivas.
|
|
|
|
|
I would like to know how to display a message box with an "Are you sure you want to exit?" when someone clicks the close button, therefore the cross button. I managed to do it in a simple button but I think it's different in the close button! Can someone help me please?!
Thanks
Alison
|
|
|
|