|
string[] names = new string[this.Controls.Count];
int i = 0;
foreach (Control c in this.Controls)
{
names[i] = c.Name;
i++;
}
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
PLease help. Thank u.
DataRow[] row = dataSet1.Profiles.Select("[ProfileId] != '" + dr.ProfileID + "'");
Error Message:
Cannot interpret token '!' at position 13.
|
|
|
|
|
CandyMe wrote: Error Message:
Cannot interpret token '!' at position 13.
Instead of != use <> , and if I am not mistaking when comparing with values the values must not be between quotes...
Note that != is a not equality and = is a equality operator in SQL.
DataRow[] rows = dataSet1.Tables["Profiles"].Select("[ProfileId] <> " + dr.ProfileId);
I hope you understand...because is a rough world out there...
|
|
|
|
|
Thank you it works. I needed to put it inside single quotation as the ID is varchar. thanks!
|
|
|
|
|
hello dear,
i am learning component development in C#.i create my own class library with name HelloWorld.Dll.
in this, i create a class MyComponet. i am using it in window based application in C#.
by including all rererences System.EnterpriseServices and Dll file. but when i create new object of that component it will
give Exception
Acess is Denied on this line
HelloWorld.MyComponent obj = new HelloWorld.MyComponent();
And in stack trace. it give the information.
Acess is Denied
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess,
String& uri)
at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type serverType, Object[] props, Boolean
bNewObj)
at HelloClient.Form1.cmdWakeUp_Click(Object sender, EventArgs e) in d:\ankush\books\course cds\bulding com+
application\practices\cs\mod02\solution\helloclient\form1.cs:line 104
So plz help me how i can use my Dll file and remove this Exception.
waiting for ur reply.......
Ankush
Ankush Bindra
Sr. Software Engineer
Schenker India Pvt. Ltd.
New Delhi, India
|
|
|
|
|
Hi,
Try this,
Sometimes this would be the problem. Check your dll property, if it is read only give read write permissions. And give read, write permissions to the files in Debug folder.
I am telling this, because I also had to face this problem. I could solve my problem by doing this.
Regards!
|
|
|
|
|
Hi All,
I'm using Microsoft Enterprise Library Configuration Application Block to configure my application. In my App.Config I have the following code snippet:
<br />
<configuration><br />
<configSections><br />
<section name="enterpriselibrary.configurationSettings" type="System.Configuration.IgnoreSectionHa X| ndler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /><br />
</configSections><br />
<enterpriselibrary.configurationSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" defaultSection="" applicationName="Application" xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
<configurationsections>
<configurationsection name="EditorSettings" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="EditorSettings.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
<keyalgorithmstorageprovider xsi:nil="true">
My EditorSettings.Config file looks like:
<br />
<br />
<editorsettings><br />
<xmlserializersection type="ConfigFile.SettingsClass, ConfigFile, Version=1.0.2146.19246, Culture=neutral, PublicKeyToken=null"><br />
<settingsclass xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><br />
<username>Administrator<br />
<clientname>uuuu<br />
<appname>uh<br />
<br />
<br />
<br />
<br />
My question is: In my App.config, can I add one more <configurationsection> inside <configurationsections>. If yes, how can I include it in my EditorSettings.Config file? How can i access this new section from my code. <br />
<br />
Thank You.<br />
<br />
<br />
-- modified at 1:15 Tuesday 22nd November, 2005
|
|
|
|
|
Adding a new key
<appSettings>
<add key="AdminUserName" value="admin"></add>
<appSettings>
Retriving the key value
System.Configuration.ConfigurationSettings.AppSettings["AdminUserName"]
Regards!
-- modified at 1:33 Tuesday 22nd November, 2005
|
|
|
|
|
To Write in coniguration File name "App1.config"
XmlTextWriter xw= new XmlTextWriter("App1.Config",null);
xw.Formatting=Formatting.Indented;
xw.WriteStartDocument();
xw.WriteStartElement("configuration");
xw.WriteStartElement("appSettings");
xw.WriteStartElement("add");
xw.WriteAttributeString("key","Name Of Key");
xw.WriteAttributeString("value","Place Actual value here");
xw.WriteFullEndElement();
xw.WriteFullEndElement();
xw.WriteFullEndElement();
//xw.WriteEndElement();
xw.Flush();
xw.Close();
to Read From file
XmlTextReader xr = new XmlTextReader("App.config");
while(xr.Read())
{
switch(xr.NodeType)
{
case XmlNodeType.Element:
Console.Out.WriteLine("Element: "+ xr.Name);
while(xr.MoveToNextAttribute())
Console.Out.WriteLine(" Attribute: ["+xr.Name+"]='"+xr.Value+"'");
break;
case XmlNodeType.DocumentType:
Console.Out.WriteLine("Document: "+xr.Value);
break;
case XmlNodeType.Comment:
Console.Out.WriteLine("Comment: "+xr.Value);
break;
}
}
to Use in Application
SetConnectionString(ConfigurationSettings.AppSettings["Name of key you want to use"]);
regards
Asad Mahmood
|
|
|
|
|
How to get the code(["SerialNumber"]) of harddisk of local area network
I know the name of computer
|
|
|
|
|
You must be an Administrator -On this computer- I think, and then do it with
The WMI SDK[^].
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
how to get XML tag of different sites for use in our sites for news reading.Concept of RSS is used here.These xml tag are used in our form which displays the updated news,\
|
|
|
|
|
|
Why does the article you link to make you think you can read passwords from AD? I couldn't find a single line where something similar is mentioned.
But apart from the article: no, you can't.
Regards,
mav
|
|
|
|
|
mav.northwind wrote: Why does the article you link to make you think you can read passwords from AD? I couldn't find a single line where something similar is mentioned.
here's eight lines:
<br />
public static DirectoryEntry GetDirectoryEntry()<br />
{<br />
DirectoryEntry de = new DirectoryEntry();<br />
de.Path = LDAP:
de.Username = @"yourdomain\sampleuser";<br />
de.Password = "samplepassword";<br />
return de;<br />
}<br />
Norman Fung
|
|
|
|
|
Let's clarify the difference between read and write:
- read: You retrieve the (yet unknown) value of the password from a source that can give you this password. AD can not.
- write: You set the value of de.Password to a known value ("samplepassword").
mav
|
|
|
|
|
Like I said, didn't have time to try out the code (repeat: "I did not try the code"). I do understand setters/getters, thanks for the patience. Basically, I was asking "You cannot read that attribute?" or "Is there another class in this/other object library from which I could perhaps read from it Hash of the password at least? or there's no way you can read passwords from AD?"
|
|
|
|
|
Hi folks,
I am kind of confused about C# def. about shallow copy. As far as I know, shallow copy points to the same memory location as the orginal, so if we make some changes to the copy, the orginal will be changed.
I did a test by doing the followings:
ArrayList a=new ArrayList();
a.Add(1);
a.Add(2);
ArrayList b=(ArrayList)a.Clone() /*C# says it will create a shallow copy here */
b.Add(3);
Now a and b are difference, I am confused here.
What am I misunderstading? And how to create a true deep and shallow copy in C#?
Thanks.
|
|
|
|
|
First, you need to understand the difference between value types and reference types.
All structures and primitives (such as int, long, float) are value types. Value types exist in the stack and are always copied. For example:
int a = 1;
int b = a;
All classes are reference types and their objects exist in the heap. Variables used to access class objects really only store addresses (so to speak) to their objects. Keyword "new" creates an object and returns a reference to that object. For example:
ArrayList a = new ArrayList();
ArrayList b = a;
Now, a shallow copy means that only an object's member variables are copied. This means the value types and references are copied, but the referenced objects themselves are not copied/cloned. A deep copy is when you clone the referenced objects too. You can do this by overriding your class' Clone() method and explicitly clone your reference member variables.
In the case of your ArrayList example, it's storing integers which are value types. So, changing the cloned ArrayList's items will not effect the original ArrayList. However, if the original ArrayList stored reference types instead, then that would be another story.
Phew! That was a bit long winded, but I hope that made sense.
|
|
|
|
|
the example you shown is shallow copy.
To achieved deep copy you need to create an object for arraylist and not a reference to it
ArrayList b = new ArrayList().
int i = 0
while (i < b.count)
{
a[i] = b[i];
i++;
}
shallow copy mean two pointers pointing at the same piece of memory.
|
|
|
|
|
hello. i have a menu, when a user clicks an item in it, the program calls a function, which calls another function based on the value of a combobox. the combobox isnt visible until the first function is called, how can i make the program 'wait' until an item is selected in the combobox? i try this, but it returns 1 right away.
while(clientlist.SelectedText == "Choose Client #")
continue;
clientlist.Visible = false;
return (System.Convert.ToInt32(clientlist.SelectedItem) + 1);
any suggestions?
thanks in advance,
sam kline
|
|
|
|
|
Correct me if wrong ;(
below is my idea....
1. set the combobox to be invisible
2. in the first func: set the combo box to be visible
3. In the event handler for the combo box, call the second func when user selects the item from the combo box
<< >>
|
|
|
|
|
HI,
Why don't you use selected item change event of the menu to show the combobox and execute the combobox selected Index change function.
regards
|
|
|
|
|
I'm trying to write a wrapper for this mfc dll to call from c# via p/invoke
Code128BarcodeToClipboard
[^]
I get the win32 error code 203: The system could not find the environment option that was entered.
Has anyone had any luck calling these methods from c#? I need to generate the barcode images(code 128) from an aspx page...any help would be appreciated.
Thanks
Graham
Graham
|
|
|
|
|
I thought there was C# code to generate bar codes on CP somewhere ?
Christian Graus - Microsoft MVP - C++
|
|
|
|