|
I look over some projects in CodeProject about creating FolderViev, FolderTreeView etc. in An "Explorer Style" and I see everywhere are used shell operations. Is that the only one way to do controls like this? Isn't there any simple method? Does C# and .Net provide owns classes and methods including shell instructions, or I have to write it always myself? And I have one more questions: Is there any reason that everybody use shell to manage folders instead of using such C# classes like Directory[info], File[info] and others classes included in System.IO namespace?
|
|
|
|
|
Maybe everyone is too lazy to RTFM about the file system / IO classes?
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
I don't know "what" projects you looked over. Some may explain the "why" they are using a specific approach, otherwise they are not very good articles.
|
|
|
|
|
Hi everyone,
I'm trying to compose an XML with serialization in VB.NET, but I'm having a problem with an array. What I'm looking for is to get something like this:
<root>
<item>item 1
<item>item 2
<item>item 3
But if I use a XML array with code like this:
<xml.serialization.xmlarray(elementname:="item")> _
Public Property Item() As List(Of Item)
Get
Return m_items
End Get
Set(ByVal value As List(Of Item))
m_items= value
End Set
End Property
What I get is something like this:
<root>
<item>
<item>item 1
<item>item 2
<item>item 3
How should I do it in order to get the item elements right under the root and not indented inside <item>? This is my first work with serialization and maybe I'm missing something stupid. I've been looking in some forums but I haven't found an answer to this.
Thanks in advance
|
|
|
|
|
If you just have a list of items like:
<item>
...
</item>
<item>
...
</item>
then you would need to deserialize an array like "List<Item>". Here you pass "List<Item>" as the type to the XmlSerializer. I'm not sure of the VB.Net syntax though.
-- updated: had to correct < in my post
-- modified at 9:59 Monday 1st October, 2007
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Sorry, I just realized that my message was also bad because of the html code, I paste it right below.
Tom, thanks for your answer but I don't understand you very well. Do you know the syntax in C#?
Here goes the message again:
Hi everyone,
I'm trying to compose an XML with serialization in VB.NET, but I'm having a problem with an array. What I'm looking for is to get something like this:
<root>
<item>item 1</item>
<item>item 2</item>
<item>item 3</item>
</root>
But if I use a XML array with code like this:
<Xml.Serialization.XmlArray(elementname:="Item")> _
Public Property Item() As List(Of Item)
Get
Return m_items
End Get
Set(ByVal value As List(Of Item))
m_items= value
End Set
End Property
What I get is something like this:
<root>
<Item>
<item>item 1</item>
<item>item 2</item>
<item>item 3</item>
</Item>
</root>
How should I do it in order to get the item elements right under the root and not indented inside <Item>? This is my first work with serialization and maybe I'm missing something stupid. I've been looking in some forums but I haven't found an answer to this.
Thanks in advance
|
|
|
|
|
Check out this post[^], it is the same question you are asking. I'm not sure of the exact VB.Net syntax though, so you will need to translate it from C#.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Sorry, I forgot to escape out the < so you can check the post[^] again.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Tom,
I've been looking at the post you said but I think it doesn't help me (or at least I can't find the solution). Maybe if I detail the problem a little bit further it will help
Inside my root element I have other kind of elements. For example, I would need to create an xml like this:
<house>
<door>brown</door>
<ceiling>orange</ceiling>
<window>blue</window>
<window>black</window>
<window>red</window>
</house>
What do I have to do to get those 3 <window> elements just under the <house> element and not getting something like this:
<house>
<door>brown</door>
<ceiling>orange</ceiling>
<windows>
<window>blue</window>
<window>black</window>
<window>red</window>
</windows>
</house>
I hope I'm explaining well It doesn't matter if you give me C# code, I will translate it.
Thank you very much
|
|
|
|
|
You explained it very well, but I don't think you can use the XmlSerializer like that. You may need to go with an alternate solution[^].
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Tom,
I finally made it, but with the help of your first answer I changed the line
<Xml.Serialization.XmlArray(elementname:="Item")>
with
<Xml.Serialization.XmlElement(elementname:="Item")>
Thank you very much for your help. Regards
|
|
|
|
|
While using MsmqIntegrationBinding to read transactional queues on multiple threads, when a poison message occurs (MsmqPoisonMessageException) it will set the service instance to a faulted state. When this happens, any parallel threads' transactions are rolled back (therefore the messages go back on the queue, even though they have already started processing). Assume that the process started by each of these messages is not transactional (therefore not enlisted in the transaction and not rolled back). The obvious choice is to move the poison message to another queue and restart the service instance. When this happens it will pick up the messages that have already started processing before and will cause redundant processing. Can you see any way to avoid this?
|
|
|
|
|
Hi,
We are planning to rewrite out data access layers in framework 3.0 (currently its is Framework 1.1). We are using DataSets throughout for data access, and also while passing data from Data Layer to other layers.
I have to find out alternative data containers, because DataSet would consume lots of memory because mostly we may have to fetch a few rows and for that we don't want to use a DataSet. DataTable could be an alternative, but I wanted to know if there are other data efficient data containers in new .NET Framework, or another method of data access.
I am doing my research on google, still it would be great if someone could point me in the right direction.
Regards,
Blumen
|
|
|
|
|
Please don't cross post. It doesn't help anybody your doing this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I am New to .net technology...How to Upgrade From Visual Studio 2003 to Visual Studio 2005? Also How to Convert the Projects which were developed in VS 2003 to VS 2005?? Reply Me...
|
|
|
|
|
spalanivel wrote: I am New to .net technology...How to Upgrade From Visual Studio 2003 to Visual Studio 2005?
Install Visual Studio 2005 - The two can sit happily side by side
spalanivel wrote: Also How to Convert the Projects which were developed in VS 2003 to VS 2005??
Open the solution in Visual Studio 2005. It will ask if you want to convert it.
spalanivel wrote: Reply Me...
Who else were you thinking I might reply to?
|
|
|
|
|
Thanks Colin...Plz tell what are the steps need to follow while upgrading?
|
|
|
|
|
spalanivel wrote: Plz tell what are the steps need to follow while upgrading?
Sit back, and have a nice cup of tea...
If you are worried about your code: Back it up first. Then upgrade. There isn't much more to it. You press a few buttons on the installer. Sit back and wait for it to install.
|
|
|
|
|
Colin Angus Mackay wrote: Sit back, and have a nice cup of tea...
Cardinal Fang. Bring out the comfy cushion.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Cardinal Fang. Bring out the comfy cushion.
|
|
|
|
|
Hi
i am tryin to write a login page in asp.net using c#
i have created the following method which passes 3 parameters into mySQL database stored procedure
but i am having problems extracting the ouptut value from the database and the server returns the following error
Only MySqlParameter objects may be stored
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
the piece of code with the error is
Line 65: connection.Close();
Line 66: <br />
Line 67: int valid = cmdString.Parameters.Add ("?p_valid");<br />
Line 68: <br />
Line 69:
MySqlConnection connection = new MySqlConnection (connectionString);<br />
<br />
MySqlCommand cmdString = new MySqlCommand();<br />
<br />
cmdString.Connection = connection;<br />
<br />
cmdString.CommandText = "login";<br />
cmdString.CommandType = CommandType.StoredProcedure;<br />
<br />
<br />
MySqlParameter param ;<br />
param = cmdString.Parameters.Add("?p_username", MySqlDbType.VarChar);<br />
param.Direction = ParameterDirection.Input;<br />
param.Value = txtUsername.Text;<br />
<br />
<br />
param = cmdString.Parameters.Add("?p_password", MySqlDbType.VarChar);<br />
param.Direction = ParameterDirection.Input;<br />
param.Value = txtPassword.Text;<br />
<br />
param = cmdString.Parameters.Add("?p_valid", MySqlDbType.Int32);<br />
param.Direction = ParameterDirection.Output;<br />
<br />
<br />
connection.Open();
cmdString.ExecuteNonQuery();
connection.Close();
<br />
int valid = cmdString.Parameters.Add ("?p_valid");<br />
<br />
<br />
<br />
if (valid == 1)<br />
{<br />
Server.Transfer("test.aspx");<br />
}<br />
else if (valid==0)<br />
{<br />
msgbox("your login is not valid)");<br />
}<br />
<br />
<br />
}<br />
<br />
private void msgbox(string p)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
} <br />
}
any help appreciated ps i am new to c#
|
|
|
|
|
Have you resolved this?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi all, first post thanks in advance for any help.
I'm having a problem loading an assembly via reflection into a host application. The assembly dll implements an interface written in VB.Net. Users can select which assembly they would like to load from a list in the main application's U.I. which is also written in VB.
I have written VB assemblies that implement the interface and load. I have written C# assemblies that implement the interface and load. I have sent both types of assemblies to London (I am in the U.S.)...the ones in VB load but the app doesn't see the C# assemblies at all
Any thoughts? Thanks.
|
|
|
|
|
Fort Mega wrote: Any thoughts?
Maybe London does not support C#
|
|
|
|
|
Ha ha, a very obvious but appropriate question. Since London approached me with the problem I simply assumed that they did. I have to admit, I don't know how to 'enable' C# in the .NET framework but I think I can figure that one out. Thanks for leaving no stone un-turned!
While I'm looking into that, let's assume that C# IS supported...any other thoughts?
Thanks again
|
|
|
|