|
|
People could change thefile association but, smart thinking there, hmm, how do i get the file exension to be associated with the app, without having to do it myself (right-click, open with, etc.)?
|
|
|
|
|
You can add a few keys to the registry:
Under HKCR add a key with the name of your extension, for example ".mef" (my encrypted file).
Add a subkey "Shell", a sub-subkey "Open" and a sub-sub-subkey "Command".
Set the standard value of the new "Command" key to the program you want to execute, for example "notepad %1".
So now you should have:
HKCR
+--.mef
+--Shell
+--Open
+--Command (Standard) "notepad %1"
Explorer will show the icon of the application (notepad in our example) and open notepad when you doubleclick a .mef file.
mav
|
|
|
|
|
I have a program I am writing for my own personl use that takes an XML file and interprets it into a treeview, then if a secion is clicked it shows the information between the tags in a textbox. The problem im having is with this peice of code.
XmlTextReader document = initializeXmlReader();
while((document.Name != e.Node.Tag.ToString()) && (document.GetAttribute("Name")!= e.Node.Text))
{
document.Read();
}
All the tree nodes are made up of the elemets attributes, this code works partially to go through the document and find if the right attribute, but sometimes it returns null, and does not display the next catagory's text.
Here is some sample XML.
<?xml version="1.0" encoding="utf-8" ?>
<Main Name="Desktop Sidebar Help">
<![CDATA[ TEST TEST TEST ]]>
<Key_Cat Name="Overview">
<Sub_Topic Name="Context Menu">TestTestTest</Sub_Topic>
<Sub_Topic Name="Options"></Sub_Topic>
</Key_Cat>
<Key_Cat Name="Basic Panels">
<Sub_Cat Name="Communication">
<Key_Topic Name="Mail Checker Panel">
</Key_Topic>
<Key_Topic Name="Messenger Panel">
</Key_Topic>
<Key_Topic Name="Miranda IM">
</Key_Topic>
</Sub_Cat>
<Sub_Cat Name="Groups Panels">
<Key_Topic Name="Stack Group">
</Key_Topic>
<Key_Topic Name="Tile Group">
</Key_Topic>
</Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="News"></Sub_Cat>
<Sub_Cat Name="Outlook Panels"></Sub_Cat>
<Sub_Cat Name="System"></Sub_Cat>
</Key_Cat>
<Key_Cat Name="3rd Party Panels">
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
</Key_Cat>
<Key_Cat Name="Skin Development">
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
</Key_Cat>
<Key_Cat Name="Plugin Development">
<Sub_Cat Name="DS SDK Documentation Forum - About"></Sub_Cat>
<Sub_Cat Name="Creating/Adding a Panel">
<Key_Topic Name="Creating an Empty Panel"></Key_Topic>
<Key_Topic Name="Adding Your Panel to Desktop Sidebar">trdtfgrgbergbergbergber</Key_Topic>
</Sub_Cat>
<Sub_Cat Name="Creating a Panel Installation File "></Sub_Cat>
<Sub_Cat Name="Publishing Your Panel"></Sub_Cat>
<Sub_Cat Name="Using Components"></Sub_Cat>
<Sub_Cat Name="Reference"></Sub_Cat>
<Sub_Cat Name="FAQ"></Sub_Cat>
</Key_Cat>
<Key_Cat Name="FAQ">
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
</Key_Cat>
<Key_Cat Name="Universal Help Engine">
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
</Key_Cat>
<Key_Cat Name="About Universal Help Engine">
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media"></Sub_Cat>
<Sub_Cat Name="Media">TESTTESTTEST</Sub_Cat>
</Key_Cat>
<Location ID="http://"><Location>
</Main>
I've been testing it by just clicking the first few treenodes that have a different attribute. But most of the time only one or two will work before it is just stays on the same thing for anything else I click. This is really bothering me. I edited out the text that was inbetween the tags, for length problems in this posting.
Sample of what its doing.
Tree
Desktop Sidebar
--OverView
---Context
---Options
--BasicPanels
---Communication
----Mail Checker Panel
----Messanger Panel
----Miranda IM
and so on
When I click mail checker panel for instance, it will show up right. But then if I click messanger Panel, it will show up with Main Check Panels text instead of Messanger Panels Text, upon debugging I noticed that getattribute is returnning null sometimes, I beleive this is the problem. The text between the tags will, contain HTML which is parsed by the textbox/web browser i've incorpertaited.
Any help would be much apperiated. Also if more code is needed I can post it.
|
|
|
|
|
|
Fixed, first time using this bb software, more accustomed to vb, ivb, phpbb, and ubb....lol
|
|
|
|
|
Hello everyone,
I have a problem with Encrypting and Decrypting files. I read an article about it at the Microsoft-Homepage but this example works only with text files and I want to encrypt and decrypt every file type.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;307010[^].
Maybe the problem is Encoding.
Please help me!
|
|
|
|
|
Actually, the encrypt function will work with any file type, but the decrypt function might not. StreamReader and StreamWriter are to help with reading/writing text from/to streams, so you don't want to use them in this case.
The example code there isn't very efficient for large files either, since it reads in the whole file at once, and your memory will be stuffed.
Here's a more practical version of the last section of the EncryptFile function:
<br />
byte[] buffer = new byte[1024];<br />
int len;<br />
<br />
while((len = fsInput.Read(buffer, 0, buffer.Length)) != 0)<br />
{<br />
cryptostream.Write(buffer, 0, len);<br />
}<br />
cryptostream.Close();<br />
fsInput.Close();<br />
fsEncrypted.Close();<br />
And here's the last 5 lines of the DecryptFile function, works for any file type and file size:
<br />
byte[] buffer = new byte[1024];<br />
int len;<br />
FileStream fsDecrypted = new FileStream(sOutputFilename, FileMode.Create);<br />
while((len = cryptostreamDecr.Read(buffer, 0, buffer.Length)) != 0)<br />
{<br />
fsDecrypted.Write(buffer, 0, len);<br />
}<br />
|
|
|
|
|
|
|
I get this error message when I use the Update oleDbCommand in my program. I cannot find the word 'DEFAULT' in any of my code. What does it mean?
Thanks
Mark Garcia
|
|
|
|
|
Did you toggle all outlining before you search for the text "DEFAULT"?
If so, please submit some code here (especially the line(s) the exception is thrown so we can help you.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Yes I did toggle outlining. Here is thae code for update...
public void UpdateDataSource(FinalSiteSafetyPlanBuilder.dsBuildPlan ChangedRows)
{
try
{
// The data source only needs to be updated if there are changes pending.
if ((ChangedRows != null))
{
// Open the connection.
this.oleDbConnection2.Open();
// Attempt to update the data source.
oleDbDataAdapter6.Update(ChangedRows);
}
}
catch (System.Exception updateException)
{
// Add your error handling code here.
throw updateException;
}
finally
{
// Close the connection whether or not the exception was thrown.
this.oleDbConnection2.Close();
}
}
public void UpdateDataSet()
{
// Create a new dataset to hold the changes that have been made to the main dataset.
FinalSiteSafetyPlanBuilder.dsBuildPlan objDataSetChanges = new FinalSiteSafetyPlanBuilder.dsBuildPlan();
// Stop any current edits.
this.BindingContext[dsBuildPlan,"BPlan"].EndCurrentEdit();
// Get the changes that have been made to the main dataset.
objDataSetChanges = ((FinalSiteSafetyPlanBuilder.dsBuildPlan)(dsBuildPlan.GetChanges()));
// Check to see if any changes have been made.
if ((objDataSetChanges != null))
{
try
{
// There are changes that need to be made, so attempt to update the datasource by
// calling the update method and passing the dataset and any parameters.
this.UpdateDataSource(objDataSetChanges);
dsBuildPlan.Merge(objDataSetChanges);
dsBuildPlan.AcceptChanges();
}
catch (System.Exception eUpdate)
{
// Add your error handling code here.
throw eUpdate;
}
// Add your code to check the returned dataset for any errors that may have been
// pushed into the row object's error.
}
}
Here is the click event code.....
private void btnUpdate_Click(object sender, System.EventArgs e)
{
try
{
// Attempt to update the datasource.
this.UpdateDataSet();
}
catch (System.Exception eUpdate)
{
// Add your error handling code here.
// Display error message, if any.
System.Windows.Forms.MessageBox.Show(eUpdate.Message);
}
this.dsBuildPlan_PositionChanged();
}
Thanks,
Mark
|
|
|
|
|
Don't you get the line where the exception is thrown?
I'm not sure but you might want to check the method UpdateDataSet and the line "this.BindingContext[dsBuildPlan,"BPlan"].EndCurrentEdit();"
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Thanks, I checked that line and it looks good. I think Dave may be on to something regarding the SQL Update Command Text.
Mark Garcia
|
|
|
|
|
The problem is not in your C# code, at least not directly. The syntax that it's talking about is the SQL command that the Update method is trying to execute.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is my SQL Command..I cut and pasted it here....Thanks
UPDATE BPlan
SET IncidentName = ?, DatePrepared = ?, IncidentLocation = ?, IncidentCommander = ?, SafetyOfficer = ?, HMGroup = ?, EnvHealth = ?,
AsstSafetyOfficer = ?, EntryLeader = ?, TechSpec = ?, DeconLeader = ?, SiteAccess = ?, SafeRefuge = ?, Entry1 = ?, Entry1PPE = ?, Entry2 = ?,
Entry2PPE = ?, Entry3 = ?, Entry3PPE = ?, Entry4 = ?, Entry4PPE = ?, Decon1 = ?, Decon1PPE = ?, Decon2 = ?, Decon2PPE = ?, Decon3 = ?,
Decon3PPE = ?, Decon4 = ?, Decon4PPE = ?, Material1 = ?, Cont1 = ?, Qty1 = ?, PhysState1 = ?, pH1 = ?, IDLH1 = ?, FP1 = ?, IT1 = ?, VP1 = ?, VD1 = ?,
SG1 = ?, LEL1 = ?, UEL1 = ?, Material2 = ?, Cont2 = ?, Qty2 = ?, PhysState2 = ?, pH2 = ?, IDLH2 = ?, FP2 = ?, IT2 = ?, VP2 = ?, VD2 = ?, SG2 = ?,
LEL2 = ?, UEL2 = ?, Material3 = ?, Cont3 = ?, Qty3 = ?, PhysState3 = ?, pH3 = ?, IDLH3 = ?, FP3 = ?, IT3 = ?, VP3 = ?, VD3 = ?, SG3 = ?, LEL3 = ?,
UEL3 = ?, Material4 = ?, Cont4 = ?, Qty4 = ?, PhysState4 = ?, pH4 = ?, IDLH4 = ?, FP4 = ?, IT4 = ?, VP4 = ?, VD4 = ?, SG4 = ?, LEL4 = ?, UEL4 = ?,
Material5 = ?, Cont5 = ?, Qty5 = ?, PhysState5 = ?, pH5 = ?, IDLH5 = ?, FP5 = ?, IT5 = ?, VP5 = ?, VD5 = ?, SG5 = ?, LEL5 = ?, UEL5 = ?,
HazRiskMemo = ?, LELInstr = ?, ToxInstr = ?, O2Instr = ?, RadInstr = ?, HazMonMemo = ?, StanDecon = ?, DeconMemo = ?, CommFreq = ?,
TacFreq = ?, EntryFreq = ?, MedMon = ?, MedTreatment = ?, MedMemo = ?, SiteMap = ?, EntryObjMemo = ?, SopsMod = ?, SOPMemo = ?,
SafProcMemo = ?, AsstSafetySign = ?, SafBriefTime = ?, HMGroupSign = ?, ICSign = ?
WHERE (IncidentName = ?) AND (DatePrepared = ? OR
? IS NULL AND DatePrepared IS NULL) AND (OperationalPeriod = ? OR
? IS NULL AND OperationalPeriod IS NULL) AND (TimePrepared = ? OR
? IS NULL AND TimePrepared IS NULL) AND (IncidentLocation = ? OR
? IS NULL AND IncidentLocation IS NULL) AND (IncidentCommander = ? OR
? IS NULL AND IncidentCommander IS NULL) AND (SafetyOfficer = ? OR
? IS NULL AND SafetyOfficer IS NULL) AND (HMGroup = ? OR
? IS NULL AND HMGroup IS NULL) AND (EnvHealth = ? OR
? IS NULL AND EnvHealth IS NULL) AND (AsstSafetyOfficer = ? OR
? IS NULL AND AsstSafetyOfficer IS NULL) AND (EntryLeader = ? OR
? IS NULL AND EntryLeader IS NULL) AND (TechSpec = ? OR
? IS NULL AND TechSpec IS NULL) AND (DeconLeader = ? OR
? IS NULL AND DeconLeader IS NULL) AND (SiteAccess = ? OR
? IS NULL AND SiteAccess IS NULL) AND (SafeRefuge = ? OR
? IS NULL AND SafeRefuge IS NULL) AND (Entry1 = ? OR
? IS NULL AND Entry1 IS NULL) AND (Entry1PPE = ? OR
? IS NULL AND Entry1PPE IS NULL) AND (Entry2 = ? OR
? IS NULL AND Entry2 IS NULL) AND (Entry2PPE = ? OR
? IS NULL AND Entry2PPE IS NULL) AND (Entry3 = ? OR
? IS NULL AND Entry3 IS NULL) AND (Entry3PPE = ? OR
? IS NULL AND Entry3PPE IS NULL) AND (Entry4 = ? OR
? IS NULL AND Entry4 IS NULL) AND (Entry4PPE = ? OR
? IS NULL AND Entry4PPE IS NULL) AND (Decon1 = ? OR
? IS NULL AND Decon1 IS NULL) AND (Decon1PPE = ? OR
? IS NULL AND Decon1PPE IS NULL) AND (Decon2 = ? OR
? IS NULL AND Decon2 IS NULL) AND (Decon2PPE = ? OR
? IS NULL AND Decon2PPE IS NULL) AND (Decon3 = ? OR
? IS NULL AND Decon3 IS NULL) AND (Decon3PPE = ? OR
? IS NULL AND Decon3PPE IS NULL) AND (Decon4 = ? OR
? IS NULL AND Decon4 IS NULL) AND (Decon4PPE = ? OR
? IS NULL AND Decon4PPE IS NULL) AND (Material1 = ? OR
? IS NULL AND Material1 IS NULL) AND (Cont1 = ? OR
? IS NULL AND Cont1 IS NULL) AND (Qty1 = ? OR
? IS NULL AND Qty1 IS NULL) AND (PhysState1 = ? OR
? IS NULL AND PhysState1 IS NULL) AND (pH1 = ? OR
? IS NULL AND pH1 IS NULL) AND (IDLH1 = ? OR
? IS NULL AND IDLH1 IS NULL) AND (FP1 = ? OR
? IS NULL AND FP1 IS NULL) AND (IT1 = ? OR
? IS NULL AND IT1 IS NULL) AND (VP1 = ? OR
? IS NULL AND VP1 IS NULL) AND (VD1 = ? OR
? IS NULL AND VD1 IS NULL) AND (SG1 = ? OR
? IS NULL AND SG1 IS NULL) AND (LEL1 = ? OR
? IS NULL AND LEL1 IS NULL) AND (UEL1 = ? OR
? IS NULL AND UEL1 IS NULL) AND (Material2 = ? OR
? IS NULL AND Material2 IS NULL) AND (Cont2 = ? OR
? IS NULL AND Cont2 IS NULL) AND (Qty2 = ? OR
? IS NULL AND Qty2 IS NULL) AND (PhysState2 = ? OR
? IS NULL AND PhysState2 IS NULL) AND (pH2 = ? OR
? IS NULL AND pH2 IS NULL) AND (IDLH2 = ? OR
? IS NULL AND IDLH2 IS NULL) AND (FP2 = ? OR
? IS NULL AND FP2 IS NULL) AND (IT2 = ? OR
? IS NULL AND IT2 IS NULL) AND (VP2 = ? OR
? IS NULL AND VP2 IS NULL) AND (VD2 = ? OR
? IS NULL AND VD2 IS NULL) AND (SG2 = ? OR
? IS NULL AND SG2 IS NULL) AND (LEL2 = ? OR
? IS NULL AND LEL2 IS NULL) AND (UEL2 = ? OR
? IS NULL AND UEL2 IS NULL) AND (Material3 = ? OR
? IS NULL AND Material3 IS NULL) AND (Cont3 = ? OR
? IS NULL AND Cont3 IS NULL) AND (Qty3 = ? OR
? IS NULL AND Qty3 IS NULL) AND (PhysState3 = ? OR
? IS NULL AND PhysState3 IS NULL) AND (pH3 = ? OR
? IS NULL AND pH3 IS NULL) AND (IDLH3 = ? OR
? IS NULL AND IDLH3 IS NULL) AND (FP3 = ? OR
? IS NULL AND FP3 IS NULL) AND (IT3 = ? OR
? IS NULL AND IT3 IS NULL) AND (VP3 = ? OR
? IS NULL AND VP3 IS NULL) AND (VD3 = ? OR
? IS NULL AND VD3 IS NULL) AND (SG3 = ? OR
? IS NULL AND SG3 IS NULL) AND (LEL3 = ? OR
? IS NULL AND LEL3 IS NULL) AND (UEL3 = ? OR
? IS NULL AND UEL3 IS NULL) AND (Material4 = ? OR
? IS NULL AND Material4 IS NULL) AND (Cont4 = ? OR
? IS NULL AND Cont4 IS NULL) AND (Qty4 = ? OR
? IS NULL AND Qty4 IS NULL) AND (PhysState4 = ? OR
? IS NULL AND PhysState4 IS NULL) AND (pH4 = ? OR
? IS NULL AND pH4 IS NULL) AND (IDLH4 = ? OR
? IS NULL AND IDLH4 IS NULL) AND (FP4 = ? OR
? IS NULL AND FP4 IS NULL) AND (IT4 = ? OR
? IS NULL AND IT4 IS NULL) AND (VP4 = ? OR
? IS NULL AND VP4 IS NULL) AND (VD4 = ? OR
? IS NULL AND VD4 IS NULL) AND (SG4 = ? OR
? IS NULL AND SG4 IS NULL) AND (LEL4 = ? OR
? IS NULL AND LEL4 IS NULL) AND (UEL4 = ? OR
? IS NULL AND UEL4 IS NULL) AND (Material5 = ? OR
? IS NULL AND Material5 IS NULL) AND (Cont5 = ? OR
? IS NULL AND Cont5 IS NULL) AND (Qty5 = ? OR
? IS NULL AND Qty5 IS NULL) AND (PhysState5 = ? OR
? IS NULL AND PhysState5 IS NULL) AND (pH5 = ? OR
? IS NULL AND pH5 IS NULL) AND (IDLH5 = ? OR
? IS NULL AND IDLH5 IS NULL) AND (FP5 = ? OR
? IS NULL AND FP5 IS NULL) AND (IT5 = ? OR
? IS NULL AND IT5 IS NULL) AND (VP5 = ? OR
? IS NULL AND VP5 IS NULL) AND (VD5 = ? OR
? IS NULL AND VD5 IS NULL) AND (SG5 = ? OR
? IS NULL AND SG5 IS NULL) AND (LEL5 = ? OR
? IS NULL AND LEL5 IS NULL) AND (UEL5 = ? OR
? IS NULL AND UEL5 IS NULL) AND (HazRiskMemo = ? OR
? IS NULL AND HazRiskMemo IS NULL) AND (LELInstr = ? OR
? IS NULL AND LELInstr IS NULL) AND (ToxInstr = ? OR
? IS NULL AND ToxInstr IS NULL) AND (O2Instr = ? OR
? IS NULL AND O2Instr IS NULL) AND (RadInstr = ? OR
? IS NULL AND RadInstr IS NULL) AND (HazMonMemo = ? OR
? IS NULL AND HazMonMemo IS NULL) AND (StanDecon = ? OR
? IS NULL AND StanDecon IS NULL) AND (DeconMemo = ? OR
? IS NULL AND DeconMemo IS NULL) AND (CommFreq = ? OR
? IS NULL AND CommFreq IS NULL) AND (TacFreq = ? OR
? IS NULL AND TacFreq IS NULL) AND (EntryFreq = ? OR
? IS NULL AND EntryFreq IS NULL) AND (MedMon = ? OR
? IS NULL AND MedMon IS NULL) AND (MedTreatment = ? OR
? IS NULL AND MedTreatment IS NULL) AND (MedMemo = ? OR
? IS NULL AND MedMemo IS NULL) AND (SiteMap = ? OR
? IS NULL AND SiteMap IS NULL) AND (EntryObjMemo = ? OR
? IS NULL AND EntryObjMemo IS NULL) AND (SopsMod = ? OR
? IS NULL AND SopsMod IS NULL) AND (SOPMemo = ? OR
? IS NULL AND SOPMemo IS NULL) AND (SafProcMemo = ? OR
? IS NULL AND SafProcMemo IS NULL) AND (AsstSafetySign = ? OR
? IS NULL AND AsstSafetySign IS NULL) AND (SafBriefTime = ? OR
? IS NULL AND SafBriefTime IS NULL) AND (HMGroupSign = ? OR
? IS NULL AND HMGroupSign IS NULL) AND (ICSign = ? OR
? IS NULL AND ICSign IS NULL);
SELECT IncidentName, DatePrepared, OperationalPeriod, TimePrepared, IncidentLocation, IncidentCommander, SafetyOfficer, HMGroup,
EnvHealth, AsstSafetyOfficer, EntryLeader, TechSpec, DeconLeader, SiteAccess, SafeRefuge, Entry1, Entry1PPE, Entry2, Entry2PPE,
Entry3, Entry3PPE, Entry4, Entry4PPE, Decon1, Decon1PPE, Decon2, Decon2PPE, Decon3, Decon3PPE, Decon4, Decon4PPE, Material1,
Cont1, Qty1, PhysState1, pH1, IDLH1, FP1, IT1, VP1, VD1, SG1, LEL1, UEL1, Material2, Cont2, Qty2, PhysState2, pH2, IDLH2, FP2, IT2,
VP2, VD2, SG2, LEL2, UEL2, Material3, Cont3, Qty3, PhysState3, pH3, IDLH3, FP3, IT3, VP3, VD3, SG3, LEL3, UEL3, Material4, Cont4, Qty4,
PhysState4, pH4, IDLH4, FP4, IT4, VP4, VD4, SG4, LEL4, UEL4, Material5, Cont5, Qty5, PhysState5, pH5, IDLH5, FP5, IT5, VP5, VD5, SG5,
LEL5, UEL5, HazRiskMemo, LELInstr, ToxInstr, O2Instr, RadInstr, HazMonMemo, StanDecon, DeconMemo, CommFreq, TacFreq,
EntryFreq, MedMon, MedTreatment, MedMemo, SiteMap, EntryObjMemo, SopsMod, SOPMemo, SafProcMemo, AsstSafetySign,
SafBriefTime, HMGroupSign, ICSign
FROM BPlan
Mark Garcia
|
|
|
|
|
Well, I have no idea. But I would suspect and start researching the possibility that you've either hit a statement length limit or a limit on the number of parameters, or a limit on the complexity of the statement. You could get away with something like this in SQL Server. I'm not so sure about the Jet database engine.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks.... I'll check that out...
|
|
|
|
|
I have a windows form and the first thing I want to happen is for a MessageBox to ask a Yes/No question after the form loads. However, I want the form to fully render itself before the MessageBox pops up. If I put the MessageBox.Show in the form constructor or in the form's Load method, the MessageBox appears first thing and the form does not appear until the user answers the MessageBox.
What do I need to do?
Thanks,
Mark Mokris
|
|
|
|
|
Hello,
Maybe you could call the Form's Invalidate method before showing the messasge box.
Peter
|
|
|
|
|
Is the form supposed to wait on the message box to do something? If not, you can create a thread to show the message box. This will assure that your app will paint itself in the background. Make sure the messagebox is on top though.
|
|
|
|
|
|
I am trying to write then read my first XML file. It is meant to store settings for a device. The user will store stuff to the file, then maybe load it back and transmit it to the target board. Sounds pretty simple.
My question is how to parse this guy. How do I get the data back out so I can plop it on the forms I've created? I see how to rifle through the file, but now how the heck to see where I am. I'm very new to this, so a real-world example would be great.
Here's how I'm setting up to do the read.
StreamReader stream = new StreamReader(fi.FullName);
XmlTextReader reader = new XmlTextReader(stream);
XmlSchemaCollection schemaColl = new XmlSchemaCollection();
schemaColl.Add(null,"XMLSchema_LCData.xsd");
XmlValidatingReader valReader = new XmlValidatingReader(reader);
valReader.ValidationType = ValidationType.Schema;
valReader.Schemas.Add(schemaColl);
valReader.ValidationEventHandler += new ValidationEventHandler(valHandler);
while (valReader.Read())
{
// Now what? How would I know that I have some certain piece of data?
// Pretend I want to know that is the FINV0 for CreepB from the XML file.
}
Here's the XML file I am trying to parse:
<xmlschema_lcdata xmlns="http://tempuri.org/XMLSchema_LCData.xsd">
<datesaved>2/25/2005 1:51:54 PM
<softwarename>X-RES
<softwarepartnumber> 172814r
<softwareversion>0.1.0
<serialnumber>someCell
<partnumber>somenumber
<ad_configuration>
<roughcal>40.591
<tempgain>11.95457
<tempoffset>-884002
<tempoffset>16
<inputqr>40
<outputdecimator>1
<temperaturedecimator>8
<temperatureqr>10
<ad_runtime>
<retrainthreshold>120
<hysteresisthreshold>60
<noiserequirement>4
<openloopqr>255
<maxqr>70
<minqr>20
<systemtc>
<za>169666
<zb>0.01226807
<zc>-4.305039E-07
<sb>4.582489E-08
<sc>-5.763168E-13
<linearity>
<cor>1.255103E-10
<gain>0.9998779
<creep>
<creepa>
<finv0>6.496906E-05
<finv1>0
<finv2>0
<tau0>0.001777649
<tau1>0
<tau2>0
<creepb>
<finv0>4.994869E-05
<finv1>0
<finv2>0
<tau0>0.0001777411
<tau1>0
<tau2>0
<creepc>
<finv0>9.953976E-06
<finv1>0
<finv2>0
<tau0>5.924702E-05
<tau1>0
<tau2>0
<hysteresis>
<zero>119020
968630
<guardband>200
<increasing>
<a_term>0
<b_term>0
<c_term>0
<e_term>-1.065821E-12
<increasing>
<a_term>8E-05
<b_term>-8.259087E-11
<c_term>0
<e_term>-1.065821E-12
Any help?
Kenny O'Dell
Sr. R&D Software Engineer
Mettler-Toledo Inc.
Inman, SC
|
|
|
|
|
Sorry, didn't realize is was going to strip out the XML stuff. I'll try again.
I am trying to write then read my first XML file. It is meant to store settings for a device. The user will store stuff to the file, then maybe load it back and transmit it to the target board. Sounds pretty simple.
My question is how to parse this guy. How do I get the data back out so I can plop it on the forms I've created? I see how to rifle through the file, but now how the heck to see where I am. I'm very new to this, so a real-world example would be great.
Here's how I'm setting up to do the read.
StreamReader stream = new StreamReader(fi.FullName);
XmlTextReader reader = new XmlTextReader(stream);
XmlSchemaCollection schemaColl = new XmlSchemaCollection();
schemaColl.Add(null,"XMLSchema_LCData.xsd");
XmlValidatingReader valReader = new XmlValidatingReader(reader);
valReader.ValidationType = ValidationType.Schema;
valReader.Schemas.Add(schemaColl);
valReader.ValidationEventHandler += new ValidationEventHandler(valHandler);
while (valReader.Read())
{
// Now what? How would I know that I have some certain piece of data?
// Pretend I want to know that is the FINV0 for CreepB from the XML file.
}
Here's the XML file I am trying to parse:
<?xml version="1.0"?>
<XMLSchema_LCData xmlns="http://tempuri.org/XMLSchema_LCData.xsd">
<DateSaved>2/25/2005 1:51:54 PM</DateSaved>
<SoftwareName>X-RES</SoftwareName>
<SoftwarePartNumber> 172814r</SoftwarePartNumber>
<SoftwareVersion>0.1.0</SoftwareVersion>
<SerialNumber>someCell</SerialNumber>
<PartNumber>somenumber</PartNumber>
<AD_Configuration>
<RoughCal>40.591</RoughCal>
<TempGain>11.95457</TempGain>
<TempOffset>-884002</TempOffset>
<TempOffset>16</TempOffset>
<InputQR>40</InputQR>
<OutputDecimator>1</OutputDecimator>
<TemperatureDecimator>8</TemperatureDecimator>
<TemperatureQR>10</TemperatureQR>
</AD_Configuration>
<AD_Runtime>
<RetrainThreshold>120</RetrainThreshold>
<HysteresisThreshold>60</HysteresisThreshold>
<NoiseRequirement>4</NoiseRequirement>
<OpenLoopQR>255</OpenLoopQR>
<MaxQR>70</MaxQR>
<MinQR>20</MinQR>
</AD_Runtime>
<SystemTC>
<ZA>169666</ZA>
<ZB>0.01226807</ZB>
<ZC>-4.305039E-07</ZC>
<SB>4.582489E-08</SB>
<SC>-5.763168E-13</SC>
</SystemTC>
<Linearity>
<Cor>1.255103E-10</Cor>
<Gain>0.9998779</Gain>
</Linearity>
<Creep>
<CreepA>
<FinV0>6.496906E-05</FinV0>
<FinV1>0</FinV1>
<FinV2>0</FinV2>
<Tau0>0.001777649</Tau0>
<Tau1>0</Tau1>
<Tau2>0</Tau2>
</CreepA>
<CreepB>
<FinV0>4.994869E-05</FinV0>
<FinV1>0</FinV1>
<FinV2>0</FinV2>
<Tau0>0.0001777411</Tau0>
<Tau1>0</Tau1>
<Tau2>0</Tau2>
</CreepB>
<CreepC>
<FinV0>9.953976E-06</FinV0>
<FinV1>0</FinV1>
<FinV2>0</FinV2>
<Tau0>5.924702E-05</Tau0>
<Tau1>0</Tau1>
<Tau2>0</Tau2>
</CreepC>
</Creep>
<Hysteresis>
<Zero>119020</Zero>
<Span>968630</Span>
<GuardBand>200</GuardBand>
<Increasing>
<A_Term>0</A_Term>
<B_Term>0</B_Term>
<C_Term>0</C_Term>
<E_Term>-1.065821E-12</E_Term>
</Increasing>
<Increasing>
<A_Term>8E-05</A_Term>
<B_Term>-8.259087E-11</B_Term>
<C_Term>0</C_Term>
<E_Term>-1.065821E-12</E_Term>
</Increasing>
</Hysteresis>
</XMLSchema_LCData>
Any help?
Kenny O'Dell
Sr. R&D Software Engineer
Mettler-Toledo Inc.
Inman, SC
|
|
|
|
|