|
I have a DataSet object defined by a XML-schema. One of the columns in the datatable should store an element also defined in the xml-schema (using ref="my_second_element").
I put the values I want to store in the dataset in an array of objects (Object[]) and set DataRow.ItemArray to my array. This works fine when I don't try to set the column of "my_second_element", but if I set that column I get an error. I have tried converting the object to store in that column to among other things an XmlElement but without luck. The error reads:
System.InvalidCastException: Specified cast is not valid.
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <system.xml.xmlelement> in KuR_Id Column. Expected type is Int32
(KuR is the name of the datatable).
I get the impression that the object value is being stored in the record-place and not in the value-place. Can anyone tell me what I'm doing wrong? I have tried to set the datatype of the column to System.Object but I got the error that parent and child columns don't have type-matching columns.
Any help will be greatly appreciated
/EnkelIk
Code sample that may help to clarify my problem:
DataSet vscDS, vscDS2;
DataTable vscDT,vscDTP;
DataRow vscDR,vscDRP;
DataTableCollection vscDTC, vscDTC2;
DataColumn vscDC;
object[] arrDR=new object[9];
short sIndex;
XmlElement vscXElem;
XmlDocument vscXDoc= new XmlDocument();
vscDS=new DataSet("Register");
vscDS.ReadXmlSchema(strSchemaFile);
vscDTC=vscDS.Tables;
vscDT=vscDTC["KuR"];
vscDC=vscDT.Columns[8];
//Add values
if(vscDT!=null)
{
vscDR=vscDT.NewRow();
arrDR[0]="";
arrDR[1]="";
arrDR[2]="";
arrDR[3]=m_strKType;
arrDR[4]=m_strEBet;;
arrDR[5]=m_strPoint;
arrDR[6]=m_strBen;
arrDR[7]=m_strBet;
//Adding object
if(m_arrgodkP.Count>0)
{
vscDS2=new DataSet("Register2");
vscDS2.ReadXmlSchema(strSchemaFile);
vscDTC2=vscDS2.Tables;
vscDTProv=vscDTC2["PR"];
if(vscDTProv!=null)
{
//m_scPR is a self defined class and method ConvertRow returns its values in a DataRow
vscDRP=m_scPR.ConvertRow(vscDTP);
//Create xml dokument and load xmlstructure from dataset
vscXDoc.LoadXml(vscDS2.GetXml());
vscXElem=vscXDoc.DocumentElement;
//Add element
arrDR[18]=vscXElem;
}
}
vscDR.ItemArray=arrDR;
vscDT.Rows.Add(vscDR);
}
|
|
|
|
|
Hallo, all...
Does anybody know how to insert created by user OLE objects in Crystal report using Visual Studio 7.0. editor. I create my own ATL Object and it is not shown in crystal's OLE objects list, but for example in Microsoft Word I can see it. What is the metter?
|
|
|
|
|
Hi expert:
I am working on this for 2 weeks already. but still canot find solution.could any expert suggest solution?
I am trying to draw on movie playing in mediaplayer. I can draw on empty mediaplayer. but when select movie, the draw graphic was hidden behind the movie. but i want to show the graphic on the movie, how can i achieve that?
I know that is very diffcult problem. if u have knowledge on this scope, pls give me some ideas, as long as u think that will help me.
very appreaciate for your contribution.
|
|
|
|
|
Well, this is kind of a late answer, but maybe it'll help.
The video is shown in overlay mode, which is some special mode that bypasses some of Windowses normal drawing things and goes straight to the video card. Try to search for something related to overlays.
|
|
|
|
|
Hi,
We currently have a DOS application written in c/c++ that read and write directly to the parallel port. We are thinking of porting the application over to C# to run on Windows XP.
How/What do I need to be able to read and write to the Parallel Port?
Any information you could provide will be much appreciated.
TIA,
Linh
|
|
|
|
|
There was some code published on the gotdotnet.com website under user samples section some time ago that gives you a COM port stream - you should be able to find it no problem.
|
|
|
|
|
I'm embarrassed to even ask this question.
But i gotta know...:/
As you can tell, i'm green on c#.
Thanks in advance
...Steve
|
|
|
|
|
Have you considered docking. Most of the controls have docking property.
Cheers,
Kannan
|
|
|
|
|
I just figured out that .Anchor property.
Those MS guys think of everything :/
That's what ya mean, right?
Thanks!
...Steve
|
|
|
|
|
Use Anchor property as well
Hi,
AW
|
|
|
|
|
Thanks! This c# stuff is just WAY too easy...:/ ...Steve
|
|
|
|
|
I'm in the middle of a Windows Forms application with a bunch of TextBoxes. Regular key presses fire KeyUp, KeyPress and KeyDown events. But the Delete key doesn't fire KeyPress. Why? I need to get the text BEFORE it's changed, so I'm trapping it in KeyPress, but when I press the Delete Key, this event doesn't fire. Can someone help? What am I missing here...
TIA
Mark.
Mark Malin
(00==[||]==00)
|
|
|
|
|
I would override IsInputKey(Keys keydata) just to know if the delete key is trapped there. (Keys.Delete = 0x2E).
|
|
|
|
|
I was not able to override IsInputKey or IsInputChar. As far as I could tell, my code was never called.
While developing an Explorer Bar in C#, using the BandObject control, the Backspace seems to be ignored -- it is never passed on to the textbox which is a child of my Explorer Bar. A KeyPress event is never triggered for the Backspace key.
What is a good solution? I've heard that trapping the key in TranslateAcceleratorIO is the way to go, which makes sense, but I don't know what to do from there. I wouldn't mind firing an event from there, but how do I fire the event with the right event source? Or is there something I can override to prevent the Backspace key from being trapped?
Thanks,
Arun
|
|
|
|
|
Anyone know of any good articles on the design of modular apps, apps that can utilise plug-ins for example. In the style of winamp's plugins. Such that supplement to distribution, new features can be added to the app without having to re-build the app itself.
"How long has the "Quote Selected Text" been around???" - Marc Clifton, Lounge 4 Mar '03 "But a fresh install - it's like having clean sheets" - Chris Maunder Lounge 3 Mar '03
|
|
|
|
|
THe .NET reflection API opens the door of a new generation of open apps that can guess entry points of plug-ins, at run-time. I believe the MSDN mag has a few articles about it.
If your plugins are supposed to implement a simple interface, then there is no nothing particularly new or odd with assemblies. They work like dlls.
Plugins can be declared either in the application .config file, or dynamically loaded at run-time by code( System.AppDomain.Load(...) ).
|
|
|
|
|
Any particular keywords I should search for? I've tried 'modular applications' and 'plugins'.
Its the principle of, there is an app that knows everything it needs to to run, but then I wanna add a dialog box/form that does something else say a media player or something. I'd need it to add a menu/toolbar item in the main app, then that would load the form (contained in the plugin dll).
"How long has the "Quote Selected Text" been around???" - Marc Clifton, Lounge 4 Mar '03 "But a fresh install - it's like having clean sheets" - Chris Maunder Lounge 3 Mar '03
|
|
|
|
|
Jonny Newman wrote:
Its the principle of, there is an app that knows everything it needs to to run, but then I wanna add a dialog box/form that does something else say a media player or something. I'd need it to add a menu/toolbar item in the main app, then that would load the form (contained in the plugin dll).
I would recommend these 2 MSDN mag articles as a starting point : Dino Esposito Xml plugins[^] ; Paul Di Lascia Xml GUIs[^].
|
|
|
|
|
|
|
oh, so your a smart ass now?
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|
|
Better than a dumbass who doesn't read threads
"How long has the "Quote Selected Text" been around???" - Marc Clifton, Lounge 4 Mar '03 "But a fresh install - it's like having clean sheets" - Chris Maunder Lounge 3 Mar '03
|
|
|
|
|
rather not read threads than be a little script kiddie, making stupid little apps that just changes colour and moves around the screen.
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|
|
Hey I told you it was bloody annoying, and I was bored when I made it.
It was designed to be the most annoying app ever. Next to Clippy.
"How long has the "Quote Selected Text" been around???" - Marc Clifton, Lounge 4 Mar '03 "But a fresh install - it's like having clean sheets" - Chris Maunder Lounge 3 Mar '03
|
|
|
|
|
Jonny Newman wrote:
It was designed to be the most annoying app ever.
"Your honor, I believe Mr. Newman has 'shot himself in the foot' as it were, I rest my case."
| Website: http://www.onyeyiri.co.uk
| Sonork: 100.21142 : TheEclypse
| "If a dolar was a chicken would the chicken be evil?"
|
|
|
|