|
I have a base class, that defines an Enum.
I have one or more sub classes that redefine that Enum (using the new keyword).
I am trying to write code in the base class to iterate through the enum, as defined by the subclass that is calling the code.
Any ideas how? I'm trying to work my way through Reflection, and I can get all of the properties and methods, but cant get any info about any Enums that might be there.
Thanks
--
Dave
|
|
|
|
|
In case anyone cares:
Type[] tNested = this.GetType().GetNestedTypes(System.Reflection.BindingFlags.NonPublic);
object rt = null;
foreach (Type t in tNested)
{
rt = Activator.CreateInstance(t);
break;
}
--
Dave
|
|
|
|
|
Hi everybody.
I'm trying to create a web application with C#.net or C++ like the (windows updates from Microsoft) to let the customer of our company download automatically our executables files from the web and also let the web app automatically the install those files on their computers.
If somebody has any idea of how to do it or any source code about it, I’d appreciate.
Thanks
Ali Hidalgo
|
|
|
|
|
Well Windows Update uses a service called Background Intelligence Transfer Service (BITS). You can use this to download files or updates, then you'll have to write some code to update your application. Of course you dont have to use BITS, you can write your own downloader or use WebClient.DownloadData/File if you dont mind it holding up your app...
Dan
|
|
|
|
|
Hi gurus,
With WMI and C#, how can I detect if a network adaptor is a virtual or physical?
Thanks.
Best regards.
There is no spoon.
|
|
|
|
|
You can't check for a flag like that, but you can use the available information to POSSIBLY figure it out. Most virtual adapaters will not have an AdapterType in their Win32_NetworkAdapter class. Physical adpaters usually will. For example, you could check each adapter for an "Ethernet 802.3" Adapter Type.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
It seems that I have the correct information when I do the following SQL statement on WMI:
SELECT Description, IPAddress FROM Win32_NetworkAdapterConfiguration WHERE ((DHCPEnabled = 'TRUE') AND (IPEnabled = 'TRUE'))
But I don't know if it will work on manually configured ethernet adapters.
When I do a request on Win32_NetworkAdapter class with the AdapterTypeID set to 0 (Ethernet 802.3) I get back the 1394 adapters and a lot of other adatper types while I need only to retrieve physical network Ethernet adapters (no virtual ones).
There is no spoon.
|
|
|
|
|
No, it won't. Even VPN adapters can have those properties set to True. Also, not all properties of the class are set by the drivers manufacturers. AdapterTypeID, since it is available in XP and above only, might not be set. It, also, does not support a NULL value, so if it is not set properly, or at all, it defaults to 0. Use the string parameter AdapterType instead.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Gurus,
What is the equivalent of the MFC's combo member SetItemData and GetItemData in C# for combo boxes?
Thanks.
Best regards.
There is no spoon.
|
|
|
|
|
Hi - not a guru here but what I use to populate a combobox is: combobox.Items.Add([value]);
Not sure what you need to use to replace GetItemData I use an equivilency test eg: if([value].Equals(combobox.Text))...ect but there maybe a better way.
Hope this helped
|
|
|
|
|
Hi,
thanks.
I have found how to add personal data to combo box items
thanks anyway
There is no spoon.
|
|
|
|
|
bouli wrote:
I have found how to add personal data to combo box items
I don't know if it is what you found out, but you can add any object to a ComboBox , and it's the result of calling that object's ToString() what gets displayed in the ComboBox .
So, just create a little class that contains all your data in public fields (or properties or whatever) and override the ToString() member. Add objects of that class to the ComboBox , and that's it.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi,
This is exactly what I have done
There is no spoon.
|
|
|
|
|
Hello everybody. I'm writing from Seville, Spain. I'm trying to build a Test-generator application through a shared add-in hosted in Word, and I need to transform .xml documents to other formats like .doc, .html and .rtf. I'm convinced that possibly there are libraries, components or classes that allow these transformations.
Does anybody know something about this respect??
Has anybody ever been in a similar situation??
Thank u very much
|
|
|
|
|
xml->html = xslt
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
C# code:
public static System.UInt16 MAKEWORD(byte a, byte b)
{
return (ushort)a | ((ushort)b << 8);
}
when compiling,the error "can not implicitly convert type 'int' to 'ushot'" occur.
what's the problem?
|
|
|
|
|
You'll have to cast the return value.
public static System.UInt16 MAKEWORD(byte a, byte b)
{
return (ushort)((ushort)a | ((ushort)b << 8));
}
www.troschuetz.de
|
|
|
|
|
yes,you r right;P
thank you!
momer
|
|
|
|
|
Hi...
I have made an xml document, and uploaded it to a server...
my problem is how to uploade it again after i downloaded it..!
When i download it i do this... (not sure this is the best way to do it)
string path = @"http://www.whatever.com/web/MyFile.xml";
WebClient DLoad = new WebClient();
DLoad.DownloadFile(path, "MyFile.xml");
that works fine...!
But then when i want to uploade the file..
I have no idea how to do however i tried this...
WebClient ULoad = new WebClient();
string path = @"http://www.whatever.com/web/MyFile(1).xml";
ULoad.UploadFile(path, "MyFile.xml");
But it throws an "'System.Net.WebException' occurred in system.dll -
Additional information: The remote server returned an error: (405) Method Not Allowed."
I have no idea what to do now....
Need a way to upload the file to the server.... or to write to the xml that already is on the sever...!
Can anyone help me please...?
Thanks....!
QzRz
|
|
|
|
|
Hi All,
I have bound textboxes and other controls on a panel. If I edit the text in a textbox and move on to another control, everything works fine and I can use
HasVersion(DataRowVersion.Proposed)
to determine if there have been any changes to any control.
BUT, if I make only a single change to one text control and leave the panel afterwards by clicking into another panel on the screen, the proposed version flag is not set and I'm missing to save the change to the underlying dataset and database.
Binding:
txtCode.DataBindings.Add("Text", m_vProject, "code");
...
and after leaving the panel:
BindingManagerBase bm = BindingContext[m_vProject];
cPrjDs.tProjectRow prjRow = (cPrjDs.tProjectRow)(((DataRowView)bm.Current).Row);
if (prjRow.HasVersion(DataRowVersion.Proposed)) {
if (MessageBox.Show("save changes?", "header", ...)) {
bm.EndCurrentEdit();
To my understanding, it would be possible to catch the TextChanged event of the control and start DataRow.BeginEdit(), but this does not seem to be a practical solution for lots of controls.
Thanks for any help.
Peter
|
|
|
|
|
when i make a new windows application project and put in the main webform any control like a Button, the application throws overflow exception, but if i tried to run the application without making anychanges the application will run without exceptions, i think the problem isn't in the control because after i got the exception i removed the control from the webfrom but i still have the same error, i don't know why i got this exception while am setting the Checking Overflow/Underflow to false in the project Build properties,
anyone have suggestions ?
thanx in advance .
|
|
|
|
|
SomeOne_SurVive wrote:
when i make a new windows application project and put in the main webform
is it webform, or a windows form?
there are no facts, only interpretations
|
|
|
|
|
sorry, its a windows form , not a webform
|
|
|
|
|
Hi, just want to know what you guys do when you wish to populate DataGrid with DataSet consisting ALL customer records BUT not wanting to load ALL customers records into DataSet (or in other words, memory). For example,
DataSet dsCustomers = new DataSet();
//That's not good, you're potentially loading enough records into memory to bring down your application server.
SqlDataAdapter daCustomers = new SqlDataAdapter(
"select * from Customers", conn);
daCustomers.Fill(dsCustomers, "Customers");
dgCustomers.DataSource = dsCustomers;
dgCustomers.DataMember = "Customers";
Thanks!
Norman Fung
|
|
|
|
|
AFAIK the DataGrid has no way of dynamically loading data. There might be another grid implementation that does support...
Anyway, loading all your customers into a grid isn't a good UI practice. Its impossible to navigate that much information and make use of it. I recommend that you rethink your design to minimize the data to exactly what the user wants to see. Just a suggestion.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|