|
karteek wrote:
I donno much abt C# and .Net. So I post it so that I get the answer without wasting much time.
Actually, posting your question and waiting for an answer will take more time than reading the class documentation. It would have taken you about 2 minutes to find the answer to this one just reading the class documentation on the TreeView control.
...and you probably would have learned something else in the process too...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello, i get this error-> System.Data.SqlClient.SqlException: Login failed for user 'xxx\ASPNET'
do some one knows how to solve it?
i am new to sql and i use msde.
thank u in advance
|
|
|
|
|
You basically have three options:
1) Get some SQL Server management tools, and set up login/user permissions in the SQL Server / Database for the ASPNET user.
2) Same as above, but create a separate SQL Login account, and don't use trusted connections to the database.
3) Add the ASPNET user to the Administrators group. This, however, is not at all secure, and can have very serious side-effects.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
It sounds like your connection string is setup using Integrated Security. Avoid this and use a dedicated username and password for SQL access. You'll also have to setup that username and password for the database using SQLManager.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can anybody please help me with dropdownlist.
it must be very simple ... I have this dropdown list which returns me only 1st record .. no matter what i select.
I m using drodownlist1.seletedItem.text to see the value and it's always showing me that i have selected 1st record.
Thanks
|
|
|
|
|
Can you post a bit more of your code so we can see exactly what you are doing?
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hey Lads,
I'm have a problem here that has me confuddled.. Maybe it's something stupid but I'd appreciate any suggestions.
I have a simple class that contains some strings and an int or two. Lets call it BasicClass . Now I have an ArrayList that contains a few BasicClass objects.
I'm serializing that ArrayList (Binary serialization) into a memory stream. From the memory stream I'm pulling out the underlying byte[] which I am storing in a database.
Now, when I retrieve the data from the database (as a byte array) I create a memory stream containing the byte[] ... I deserialise the contents of the byte[] to give me a lovely ArrayList ....
Great.. everything works.. to here.
When I try to get at the contents of the ArrayList and cast them back to BasicClass objects I get an InvalidCastException (if I don't use safe casting)...
When debugging I can clearly see that the ArrayList , after being deserialized from the database etc, contains x number of object 's and each of those are of type BasicClass (or so the debugger says)... but I can't cast them back to BasicClass objects.... I call GetType() on the objects in the deserialized ArrayList and then when looking at the Type.FullName property it tells me that the object is of type BasicType .... grrrrr!!! .... If it is then why the hell can I not cast it to a BasicClass object.
I also tried the exact same using xml serialization and it gives the exact same problem.
Oh, and BasicClass is serializable, as is the ArrayList class.
Any help would be greatly greatly appreciated lads. I need this sorted ASAP.
Regards,
Brian Dela
http://www.briandela.com IE 6 required. http://www.briandela.com/pictures Now with a pictures section http://www.briandela.com/rss/newsrss.xml RSS Feed
|
|
|
|
|
I'm just curious why you're serializing the ArrayList to a MemoryStream to bet the byte[] instead of just serializing the whole shabang?
In any case, it I would venture a guess that for some strange reason, the BasicClass Type is not the same. Remember that a Type consists of the fully-qualified class name (i.e., includes the namespace), the assembly, the version, the culture and public key token). One cause of this is that perhaps you're using automatic versioning with your assembly, so that the old and new BasicClass Types differ by version. If that's true - there's your problem.
There's two ways to solve this: don't use automatic version (so little control and real pain in the arse with larger solutions, especially when you use late-binding like for plug-ins and what-not) or derive your own SerializationBinder and override BindToType . You can make this implementation generic so that the version number is basically ignored, as I did here:
public override Type BindToType(string assemblyName, string typeName)
{
string name = assemblyName.Substring(0, assemblyName.IndexOf(','));
Type t = Type.GetType(typeName + ", " + name);
return t;
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
I'm just curious why you're serializing the ArrayList to a MemoryStream to bet the byte[] instead of just serializing the whole shabang?
What do you mean?
Heath Stewart wrote:
In any case, it I would venture a guess that for some strange reason, the BasicClass Type is not the same. Remember that a Type consists of the fully-qualified class name (i.e., includes the namespace), the assembly, the version, the culture and public key token). One cause of this is that perhaps you're using automatic versioning with your assembly, so that the old and new BasicClass Types differ by version. If that's true - there's your problem.
I though that was the problem myself (I had the same issure in the past) so I disabled the automatic versioning, wiped clear any objects stored in the DB, and started again, to see if it was the issue but it didn't make any difference at all.
Regards,
Brian Dela
http://www.briandela.com IE 6 required. http://www.briandela.com/pictures Now with a pictures section http://www.briandela.com/rss/newsrss.xml RSS Feed
|
|
|
|
|
Brian Delahunty wrote:
What do you mean?
Why don't you just serialize the entire object graph? Serialize your class's members, include the ArrayList . The runtime serialization framework will serialize the ArrayList , which will serialize BasicClass . Then you just take all that and save it in the DB.
Brian Delahunty wrote:
I though that was the problem myself (I had the same issure in the past) so I disabled the automatic versioning, wiped clear any objects stored in the DB, and started again, to see if it was the issue but it didn't make any difference at all.
The InvalidCastException you're getting indicates that the classes are indeed not the same. I would check with the debugger to find out the full Type of the object and compare with what it should be.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
Why don't you just serialize the entire object graph?
Ah, K. Nah.. just want the arraylist. I don't need to serialise anything else in that class so I don't see the point.
I go tthe problem fixed. Was to do with the fact that, now I think this fixed it, one version of the assembly was signed and the other wasn't even though they both had the same version number. I think that's what it was. I done a load messng with it but it worked in the end.
Regards,
Brian Dela
http://www.briandela.com IE 6 required. http://www.briandela.com/pictures Now with a pictures section http://www.briandela.com/rss/newsrss.xml RSS Feed
|
|
|
|
|
The version number doesn't matter so long as the version does change between Types. The fact that one assembly wasn't signed could be a problem, although you should've gotten an error or at least a warning. A signed assembly cannot use an unsigned assembly, though the reverse is possible.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Haven't in a long time. Just really don't have the time.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Anyone can please help me find a sample 'C' code for decreasing connect timeout.
|
|
|
|
|
You should try the Visual C++[^] forum. This is the C# forum, where C# is a language that targets the Common Language Runtime (CLR - part of the .NET Framework).
There's also always google[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
when i run two client programs in the same pc, i got a problem, because the two program need to read one same bitmap file, when one read that, another can not ,so can you tell me how can i realize the file sharing;
|
|
|
|
|
See the FileStream class in the .NET Framework SDK. You can open a FileStream on the bitmap with a shared ability to read the file:
FileStream file = null;
try
{
file = new FileStream("test.bmp", FileMode.Open, FileAccess.Read,
FileShare.Read);
using (Bitmap bmp = new Bitmap(file))
{
}
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
}
finally
{
if (file != null) file.Close();
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have one problem: I have a enum of lexeme, to examle "try","hi","not". Please help to make a regular expression string, what find in text data lexem's.
|
|
|
|
|
If you're trying to perform lexigraphical parsing, regular expressions are not the way to go. Regular patterns are for pattern matching where a pattern is known. Linguistics is far too complex for such simple (in comparison) pattern patching.
There is plenty of material on lexicography on the Internet. I suggest you google[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks,
|
|
|
|
|
Hello all. First time posting here. I am quite new to C# and was wondering how to create the Options dialog form that is used in the VS.Net IDE. The one where the TreeView is on the left and the different controls are on the right. I have a simple application I am developing and would like to incorporate this style into my app. I have not had a chance to do a thorough search of all the posts or articles yet, but what I have searched, I have not found anything on this topic.
Any help is greatly appreciated.
Thanks again!!
|
|
|
|
|
There are several articles here on CodeProject that describe such a UI, like A designable PropertyTree for VS.NET[^]. You could search for others if you like. Just use the search box toward the top of the page (right under "Bob" and The Code Project logo).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks a lot, Heath! I appreciate your time. In the future I will do a more thorough search.
|
|
|
|
|
The reality is that most of the dialogs in the VS IDE are actually DHTML dialogs.
|
|
|
|