|
i haven't tried it yet but if it works thats perfect thanks
the only other question is how is the code activated and/or where does it go?
|
|
|
|
|
Hi Michael,
1. It does work. If you are unable to solve the problem. Feel free to revert back.
2. I will prepare a sample application with comments, and post it, when ever I get time . this will solve your other queries as well.
Regards,
Jay.
|
|
|
|
|
Hello,
i have a problem with the char typecast's or the string.toCharArray() function. when i have an extended ascii char in my string like "‹" c# converts this into the char with the integer 8249. BUT the integer i need is 0139, which is the same in HTML (http://www.netstrider.com/tutorials/HTMLRef/ASCII/[^]).
how can i solve this problem most simply? i don't wanna check every char if it's greater than 255.
|
|
|
|
|
I'm working on a fairly large program that is a graded part of my university course
all was going well until i tried to do the remoting and now i'm totaly stuck the book's i've looked at demonstrate only simple problems and don't even mention the problems i'm having
heres the main one i'm having difficulty understanding
for(int i=0;i
|
|
|
|
|
try{}catch{} wont catch any exceptions as I learnt only a few days back. Although this is acceptable to the compiler, it wont catch any exceptions unless specified.
Hope its the problem you having. Your code screwd up the formatting.
|
|
|
|
|
there is nothing to try catch as far as i'm aware, the code seems to be working but i'd don't understand why i can do X = Y and then have X.col diferent to Y.col hope that clears up any misunderstandings
and as i've got you email i'll send a copy of the code if you can't help for what ever reason i thank you for your time
|
|
|
|
|
I suggest u make Galaxy also inherit from MarshalByRefObject.
|
|
|
|
|
That was the first thing i tried but that causes a
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.
and i don't know how to get round it.
|
|
|
|
|
this
for(int i=0;itry{
GetPlayer(i).Gal.Systems = this.Gal.Systems;
}
catch{
players.RemoveAt(i);
i--;
}
}
used to be
for(int i=0;itry{
GetPlayer(i).Gal = this.Gal;
}
catch{
players.RemoveAt(i);
i--;
}
}
but i kept geting security exceptions saying the objref was unavalable and the cahnge seemed to be the only thing that fixed it, though i don't see why there was a prob in the first place as gal is an instance of
[Serializable]
public class Galaxy{
...
}
which i thought dealt with reading it for transmission
|
|
|
|
|
Hi,
I created a new class(AdvListViewItem) that inherits from the ListViewItem. This class replaces certain base class methods/properties with identical methods/properties except that the new methods/properties fire an event when they are run. However, when accessing the new method/property through the listview (ie. listview1.SelectedItems[0].Font), the methods/properties of the base listviewitem are run.
Do I have to replace the SelectedItemCollection also for my code to work?
|
|
|
|
|
You should probably override CreateControlCOllection or something like that. Look at the protected methods.
|
|
|
|
|
I realized that when I was adding the AdvListViewItem to the listview through the Items property, it was casting the AdvListViewItem to the standard ListViewItem. So I want to replace the ListViewItemCollection class represented by the Items property with a derived one that replaces the Add method with one that accepts an AdvListViewItem. The problem is I don't know how the collection stores the internal ListViewItem objects.
How do I add to the internal collection, or do I have to recreate the class completely (including my own collection)? The ControlCollection does not allow me to add listviewitems to it.
|
|
|
|
|
Anonymous wrote:
The ControlCollection does not allow me to add listviewitems to it.
Of course it won't - that's only for Control instances, which ListViewItem s are not.
You could always add your derivative ListViewItem s to the base class's Items properties, using base.Items and calling the appropriate actions. Since you hide that member, your Items collection property will be called only when referencing your type by its actual Type (and not ListView ), but nothing is preventing you from using the base class's collection property to store the items. After all, your derivative class is still a ListViewItem a la polymorphism.
Search CodeProject. There are some articles that discuss how to do this, as well as some examples I remember seeing on MSDN[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
Is there any way (C# or API) to get the icon associated with a given file type?
I've looked to SHGetFileInfo but this only works if I give a path for an existing file.
Thanks
|
|
|
|
|
You can access the HKEY_CLASSES_ROOT/<file type="">/DefaultIcon registry key and retrieve the icon from the file listed there.
There is probably a better way but this is what I know currently.
|
|
|
|
|
Didn't show up properly:
HKEY_CLASSES_ROOT/<file type>/DefaultIcon
|
|
|
|
|
Hi,
Thanks for your awnser!
I've tried that already but it doesn't seems to be the right way to do that.
There are a lot of entries that don't have the DefaultIcon entry but still have an icon associated with it.
|
|
|
|
|
|
I downloaded some projects but it didnot work because of
(usin system.win.forms) which doesnot exists....can u tell me how to make my application recognizes this directive?
|
|
|
|
|
try using System.Windows.Forms;
To those who didn't make it, we will remember you. To those who did is back. - Megan Forbes in Black FridayAnother Post by NnamdiOnyeyiri
|
|
|
|
|
also make sure the references include the system.windows.forms dll normaly located at
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll
|
|
|
|
|
is there any method to get windows and system directory in c# ?
and how to get the version of windows ?
thanks .... !
|
|
|
|
|
kendao wrote:
is there any method to get windows and system directory in c# ?
Environment.SystemDirectory
kendao wrote:
how to get the version of windows ?
Environment.Version
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
Hi,
Using the VS IDE, I have a Form which loads and manages a DataSet. The form contains UserControls that need to references the same DataSet. Using the IDE, while designing the UserControl, how do I reference the DataSet in the parent Form?
As an interim solution I drag/drop another DataSet onto the UserControl and do all my object DataBindings to that DataSet. But, after the initialization of the UserControl I have to modify each objects DataBindings to reference the DataSet in the Parent Form.
Is there a better(correct) way of doing it?
|
|
|
|
|
The best way is to have the child controls reference the DataSet from the parent form (defined as Form1 in this example). Just cast the Parent property to Form1 and get the reference to the DataSet that you should define as a public or internal property:
public class Form1 : Form
{
private DataSet dataSource;
public DataSet DataSource
{
get { return this.dataSource; }
}
}
public class UserControl1 : UserControl
{
private void BindMe()
{
SomeMethodThatBindsData(((Form1)Parent).DataSource);
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|