|
|
|
I always use a Label with a 3D border and minimum height.
|
|
|
|
|
I have seen both styles you guys described; the information has been helpful.
Ethan
-------------------------------------------
One good thing about repeating your mistakes is that you know when to cringe.
|
|
|
|
|
I've noticed that when I read an XSD into a dataset, it doesn't create a "meta-table" to encapsulate global elements. Is this something I don't understand about XSD/XML, or is something having to do with the way .NET datasets handle an XSD?
For example:
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:complexType name="PurchaseOrderType">
...
creates the "purchaseOrder" table in the data set with the various elements of the complex type.
But if the schema also contains a global element of a simple type:
<xsd:element name="AString" type="xsd:string"/>
this is nowhere in the dataset (because it's global data).
However, isn't it valid XML to say:
<AString>foobar</AString>
???
Confused!
Marc
|
|
|
|
|
Marc Clifton wrote:
this is nowhere in the dataset (because it's global data).
Same thing happens when generating a TypedDataSet. I would be nice to have. Nice quick and easy config files.
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
I would be nice to have. Nice quick and easy config files.
??? Can you elaborate on that?
BTW, the reason I'm asking this bizarre question is that I'm writing a follow-up article on my XSD Schema Editor--I want a generic XML editor that dynamically generates the appropriate GUI controls and does validation based on the XSD, and I've been looking at .NET's dataset as an in-memory container for the data. Plus it seemed like an easy way to read and write the XML.
(And all of this simply to finish my third AAL installment!)
Any thoughts?
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka
|
|
|
|
|
Marc Clifton wrote:
??? Can you elaborate on that?
Just basically having "static(read singleton)" global elements in a dataset. So it can be easily read/write to xml/file (perhaps seperate or along some data). These would be reflected via properties in the dataset's "global" scope.
Marc Clifton wrote:
I've been looking at .NET's dataset as an in-memory container for the data. Plus it seemed like an easy way to read and write the XML.
I have looking at somehtin similar (without too much hassle) to manage web controls from, similar to a CSS file, but sitewide for my custom controls (those autogenerated ones;P).
Marc Clifton wrote:
And all of this simply to finish my third AAL installment!)
You dont stop do you? I have 2 weeks before university start, still looking to squeeze in 1 article, but I have no ideas...
Cheers
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
Here is the situation:
I am writing an application that needs to detect a specific USB MMC card reader connected to the computer. I need to do this so that I can make the default save path for my application automatically be the card reader.
Possible Solution to Try:
An idea that I have is to check each drive on the computer and when the name of the drive matches the name of the reader I will know I have the right drive. I don't know how to get the name of the drive programatically but on my Windows XP Pro Machine I...
1. Open Windows Explorer.
2. Right click on the reader (labeled "Removable Disk (F)")
3. Select Properties.
4. Select the Hardware tab from the Removable Disk Properties.
5. Under the hardware tab there will be a list of "All disk drives:". In this list the specific name of the reader is listed as "eUSB Secure Digital USB Device."
"eUSB Secure Digital USB Device" is the name that I need. This name is also displayed under "Disk Drives" in the "Device Manager".
Suggestions:
1. Do you think this is a good idea to try?
2. Do you know how to do an part of the above proposal programatically?
I would like to stay in C# as much as possible but I have a feeling this is only going to be able to be done using the Windows API or some other non-.NET way.
Thank you for your help.
Mark Sanders
sanderssolutions.com
|
|
|
|
|
Mark Sanders wrote:
1. Open Windows Explorer.
2. Right click on the reader (labeled "Removable Disk (F)")
3. Select Properties.
4. Select the Hardware tab from the Removable Disk Properties.
5. Under the hardware tab there will be a list of "All disk drives:". In this list the specific name of the reader is listed as "eUSB Secure Digital USB Device."
I can get the same type of information using WMI about my IDE drives. I hope it works for the USB device:
private void button1_Click_1(object sender, System.EventArgs e)
{
String scope = "\\root\\cimv2";
ManagementScope ms = new ManagementScope(scope);
ObjectQuery oq = new ObjectQuery("Select * from win32_diskdrive");
ManagementObjectSearcher mos = new ManagementObjectSearcher(ms, oq);
ManagementObjectCollection moc = mos.Get();
foreach(ManagementObject mo in moc)
{
txtOutput.AppendText(mo["caption"].ToString() + "\r\n");
}
}
Of course you must have WMI on the system.
Matt is a network administrator for an insurance company in the midwest. He is shamelessly looking for Windows programming side work.
|
|
|
|
|
Thank you for your reply. I will mess around with your example to see if it gives me any other leads but I don't think I will be able to use it for my application. The application I am writing needs to be able to run on any client computer running Win98, Me, 2000, or XP. I don't think I will be able to guarantee WMI on the computer in which the app is installed.
I don't know much about WMI, so if my statements above are not true let me know.
Mark Sanders
sanderssolutions.com
|
|
|
|
|
WMI is available only as an add on to Win98 so this is not a good solution for you. I figured the platform would be a problem with this answer but thought I would post anyway.
Matt is a network administrator for an insurance company in the midwest. He is shamelessly looking for Windows programming side work.
|
|
|
|
|
|
>
Hey! i just checked out ur email so I am answering. The other way:
>
//Get Drive list...getDrives() implementaion last lines...
ManagementObjectCollection queryCollection = getDrives();
//Loop Here...Iterate through each Node....
foreach ( ManagementObject mo in queryCollection)
{
switch (int.Parse( mo["DriveType"].ToString()))
{
case 2: //removable drives = 2 (A:\)etc...
numberofRemovable++;
break;
case 3: //Local drives (C:\;D:\;E:\)
numberofLocalDisk++;
break;
case 5: //CD rom drives(F:\;G:\)
numberofCD++;
break;
case 4: //Network drives
numberofNetworkdrv++;
break;
default: //default to folder
break;
}
//objects = ArrayList Object here..
objects.Add(mo["Name"].ToString);
}//loop end
/////////////////////////////////////////////////////////
///
/// Gets the lists of the logical disks and their infos..
/////////////////////////////////////////////////////////
protected ManagementObjectCollection getDrives()
{
//get drive collection
ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * From Win32_LogicalDisk ");
ManagementObjectCollection queryCollection = query.Get();
return queryCollection;
}
///////////////////////////////////////////////////////////
I hope this will work for ur application too...
regards,
fahad...
I wish not to seem but to be the Best....
F a h a d H. Siddiqui
|
|
|
|
|
Hi,
I am using a vender-provided COM object in a C# Windows
Forms application to extract proprietary data format from
an AD attribute. The data is stored in an associative
array. The problem I am having is retrieving the items
that the object returns as its parameters. For example,
upon binding to an AD container object, the object creates
an instance of type Scripting.Dictionary within COM
object, and exposes this instance as a property
called "Parameters." I've tried casting to a ListDictionary,
HybridDictionary, you name it. Nothing seems to work except
IEnumerator.
The problem I'm having is how to retrieve the items for
each key in the Scripting.Dictionary collection. I'm able
to retrieve the names of the keys, but now I simply want
to get the values for each key, called "Items". I've wrapped
the Scripting.Dictionary class into a .NET assembly using
the TLBIMP libary and included it in my project. Here's a
snippet of my code so far:
// AD path to bind to
string ADsPath = "LDAP://CN=Some List,OU=Distribution
Lists,DC=DomainA,DC=CorpA,DC=com";
// instantiate the vender COM object
AGQueryClass ag = new AGQueryClass();
// bind to the AD path
ag.Set(ADsPath);
//cast ag.Parameters to Scripting.Dictionary instance
Scripting.DictionaryClass sd = (Scripting.DictionaryClass)
ag.Parameters;
// get collection enumerator
IEnumerator IEn = sd.GetEnumerator();
// array to hold keys
Array ary = Array.CreateInstance(typeof(object), sd.Count);
IEn.Reset();
IEn.MoveNext();
// populate the array with key names
for (int i=0; i
|
|
|
|
|
Try this:
using System;
using System.Collections;
using System.Collections.Specialized;
public class ScriptingUtils
{
public static IDictionary ConvertDictionary(Scripting.IDictionary dict)
{
HybridDictionary ret = new HybridDictionary(dict.Count);
foreach(object k in dict)
{
object key = k;
object value = dict.get_Item(ref key);
ret.Add(key, value);
}
return ret;
}
} You can then change your code to:
using System;
using System.Collections;
...
string ADsPath = "LDAP://CN=Some List,OU=Distribution Lists,DC=DomainA,DC=CorpA,DC=com";
AGQueryClass ag = new AGQueryClass();
ag.Set(ADsPath);
IDictionary dict = ScriptingUtils.ConvertDictionary(
(Scripting.IDictionary)ag.Parameters);
object[] keys = new object[dict.Count];
object[] values = new object[dict.Count];
int index = 0;
foreach(DictionaryEntry entry in dict)
{
keys[index] = entry.Key;
values[index] = entry.Value;
index++;
}
...
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Yes, that did it! Thank you Richard.
|
|
|
|
|
I may be being thick but I'm having problems using .CreateInstance
Dim ty As Type<br />
ty = Type.GetType("System.Windows.Forms.Textbox", True, True)
You'd think it would return a textbox type! But it errors beacuse it's trying to look for the textbox in my namespace:-
Could not load type System.Windows.Forms.TextBox from assembly xmlForms
Any ideas?
|
|
|
|
|
No, Type.GetType() won't return a TextBox , it'll return a Type . That Type is defined in the System.Windows.Forms assembly. Since you didn't get an assembly reference, the class is assumed to be in your assembly, *not* your namespace. Namespaces can span assemblies and vice-versa.
If you need to get a Type from a string, you need to specify the fully qualified assembly info, like so:
Type t = Type.GetType("System.Windows.Forms.TextBox, System.Windows.Forms, " +
"Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", true, true);
That'll tell the type loader to get that type out of the System.Windows.Forms assembly, no yours. If an assembly is in the GAC, you can just specify the fully qualified classname and the assembly. The type loader will use the latest version of that assembly. If an assembly is not in the GAC, you have to specify all type properties or use a publisher policy to to specify which version and from where the assembly comes.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Thanks Heath, that works
|
|
|
|
|
Hi
i would like to disable/hide the Close button "X" on the upper left corner, also the hot keys like control + F4, to close mdi child, should be disabled. I like to group some mdi childs, and only one child should be enabled to close. This childs than close the other ones.
Is there any way under c# ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
To keep the window from closing, handle the Form.Closing event and set the CancelEventArgs.Cancel member to true . As far as disabling the Close button, MSDN suggests removing the Close system menu item from the control bar. To do this, you'll need to P/Invoke GetSystemMenu from user32.dll and RemoveMenu from user32.dll. See "Q184686" in Microsoft KB. It's in VB, but the concept is the same.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
thanks, i will take a closer look ,)
.:Greets from Jerry Maguire:.
|
|
|
|
|
It's easy, just set ControlBox to false, and the Close Menuitem and Button are disabled.
.:Greets from Jerry Maguire:.
|
|
|
|
|
i have never used toolbars before...so humor me ( i have never needed them) anyways how can i seperate my buttons with just a panel on my tool bar.. kinda like MenuItem jr = new MenuItem("-"); in the menu. anyways thanks for the time
Cheers,
jesse m
|
|
|
|