|
I don't think you pass the right types.
You need to create your own type, like:
[XmlRoot(Namespace = "http://www........./specs/schemas/smsgw/StatusSMSMessage.xsd")]
class StatusSMSMessage
{
public StatusSMSMessage()
{
}
[XmlAttribute]
public string mtMessageId
{
get { ... }
set { ... }
}
}
And initialize your formatter:
mq.Formatter = new XmlMessageFormatter(new Type[] { typeof(StatusSMSMessage) });
This example is not exhaustive, I would read more on XML serialization if I were you.
|
|
|
|
|
I now have made my own type. The start is like this:
[XmlRoot("StatusSMSMessage", Namespace = "http://www....../specs/schemas/smsgw/StatusSMSMessage.xsd", IsNullable = false)]
public class StatusSMSMessage
{
public StatusSMSMessage() { }
[XmlAttribute("mtMessageId")]
public string mtMessageId;
....
(just removed some of the address inn the Namespace),
And i inizialize my XmlMessageFormatter like this:
using (MessageQueue mq = new MessageQueue(".\\" + qn))
{
mq.Formatter = new XmlMessageFormatter(new Type[] { typeof(StatusSMSMessage) });
...
But when i try to read the message like
object o = message.Body;
I get the message "Root element missing", but i know the message starts with
<?xml version="1.0" encoding="ISO-8859-1"?>
<StatusSMSMessage xmlns=...
I'm totally new at XML Serialization. Does anyone have a clue to why I get this error message?
|
|
|
|
|
Could you paste the entire code for your class? And also the root node of your messge, including the entire namespace?
|
|
|
|
|
Actually I solved it in a different way. Instead i used the ActiveXMessageFormatter, and got the message as plain text, and just used XmlDocument.LoadXml() to get it into an xml document.
Anyway; thanks for your time
|
|
|
|
|
Hello everyone!!!
I need to do a job to college that consists in build a simple file allocation table (FAT) emulator...
The FAT itself will be a simple unidimentional array.. and it just have to do basic operations of a very Basic File System (create, remove, update and delete files)
I´d like to do something ellegant with a friendly GUI containing the array and buttons wich triggers the operations.. Something simple and preety.... Can be C#, C++... C#´s most welcome!!!
Do anyone know something good to start reading about? Someone did somehing like? I´m already searching by the way but found nothing reliable to start....
Thanks
|
|
|
|
|
Operating system ..... any good text book
|
|
|
|
|
not reliable.... just tanembaum and deitel.....
i´d like something more....
|
|
|
|
|
It's not going to be too easy, but a FAT documentation[^] and perhaps some existing (non C#) code should do the job.
FAT is not really complex compared with newer file systems.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
Does anyone know how to delete an item in a ListBox and then, select the next one or previous one in the listbox?
Currently, I was using the next code:
int index = listBox1.SelectedIndex;
listBox1.Items.RemoveAt(index);
Reestablecer();
int cuenta = listBox1.Items.Count;
if (index < cuenta)
{
index++;
listBox1.SelectedIndex = index;
}
else
{
index--;
listBox1.SelectedIndex = index;
}
but i have a event on SelectedIndexChanged on the ListBox, so when I delete the item in the listbox, automatically the code on the SelectIndexChanged is executed and i get errors because the value of the property listbox.selecteditem is null.
Any ideas of how to solve it?
thanks in advance.
~ Bizarre what men fin attractive ~
|
|
|
|
|
When you have written this code ?
Did you try to catch last removed index value in SelectIndexChanged and manipulated your existing code as you mentioned
int cuenta = listBox1.Items.Count;
if (index < cuenta)
{
index++;
listBox1.SelectedIndex = index;
}
else
{
index--;
listBox1.SelectedIndex = index;
}
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Your problem is the remove index, when you remove an item you automatically move everything up so don't need to change selected index
|
|
|
|
|
I tried to only remove the item, but the program still executes the selectindexchanged statement.
I get the error NullRefefenceException.
~ Bizarre what men fin attractive ~
|
|
|
|
|
int index = listBox1.SelectedIndex;
if (index >= 0)
{
listBox1.Items.RemoveAt(index);
Reestablecer();
int lastItem = listBox1.Items.Count - 1;
if (index > lastItem)
{
listBox1.SelectedIndex = lastItem;
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
your code worked fine! Now i just need to check it few more times, because after i delete few items it gets again the null reference exception
thank you
~ Bizarre what men fin attractive ~
|
|
|
|
|
Try this:
int index = listBox1.SelectedIndex;
if (index >= 0)
{
listBox1.Items.RemoveAt(index);
Reestablecer();
int lastItem = listBox1.Items.Count - 1;
if (lastItem >= 0)
{
if (index > lastItem)
{
listBox1.SelectedIndex = lastItem;
}
}
else
{
listBox1.SelectedIndex = -1;
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Or this:
int index = listBox1.SelectedIndex;
if (index >= 0)
{
listBox1.Items.RemoveAt(index);
Reestablecer();
int lastItem = listBox1.Items.Count - 1;
listBox1.SelectedIndex = Math.Min(lastItem, index);
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I am using a datatable to populate a datagrid in VS2003.
I need to select a row if any cell within the grid is clicked.
I use DataGrid.Select(RowNum) to select the rows & it works on the first selected row, but if i try clicking on any other cells to select a second row, the first selection goes away.
I use ctrl+click for multiple selections.
Can someone help me with the multiple selections.
Thanks.
|
|
|
|
|
Listen, do you mean focus some rows? why that?
query your table to get only those rows in the grid? after all you are creating a condition, to select only 3 rows
Can you focus those rows with a color?
I really dont know how to help i dont know what you are doing! maybe some one can help you there.
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi all
Im trying to create a My favorite folder tab just the one outlook has but i don`t how to write the code for it.
Thank You in advance
|
|
|
|
|
craigMUTOKOKAI wrote: but i don`t how to write the code for it.
Hmmm, yes I can see how that is a problem, for you. What do you think you should do about that?
led mike
|
|
|
|
|
It shouldn't be a problem really, he's already asked how to get email from an exchange server, create a task list and create a calender control like outlook etc, so I expect someone will help him with his college coursework
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi.
I have a view that binded to a gridview.
i want to add directly in Datagrid and then the new row added to corresponded table.
what should i to do?
sepel
|
|
|
|
|
sepel wrote: what should i to do?
You should learn how Data Binding works. There are mountains of documentation and tutorials with sample code on MSDN and well as in Articles here on CodeProject.
led mike
|
|
|
|
|
i know about binding but how about bind to a view?
sepel
|
|
|
|
|
Works the same as binding to a table
|
|
|
|