Jump to content
Xtreme .Net Talk

aewarnick

Avatar/Signature
  • Posts

    1052
  • Joined

  • Last visited

Everything posted by aewarnick

  1. Or Convert.ToSingle(CommunicationLog.settings.GetValue("TitleFont.Size") Is single a float value?
  2. This is all I have found that works: MessageBox.Show(""+(float)Convert.ToDouble(CommunicationLog.settings.GetValue("TitleFont.Size")));
  3. I can't seem to do anything with float! I cannot even seem to convert a float value into a string or vice versa. Can someone help?
  4. That is probably VB and I don't think you quite know what I mean. I guess the only way is to use method overloading, right? I see someone already posted that. Ok, got my answer.
  5. I see that some methods have optional parameters. How do I do that?
  6. this.fontDialog.Font=new Font((string)CommunicationLog.settings.GetValue("TitleFont.Name"), (float)CommunicationLog.settings.GetValue("TitleFont.Size"), (FontStyle)CommunicationLog.settings.GetValue("TitleFont.Style")); That does not work, conversion error and it would be nice if I could save and load everything in one package. It can also be saved to the registry like this really easily but I cannot load it at all (it seems) this way: [Font: Name=Bangle, Size=9.75, Units=3, GdiCharSet=0, GdiVerticalFont=False] Help!
  7. I guess I will use the registry. Xml seems to Cody and slow.
  8. The above method is slow. This is faster but I know there must be a better way. Either the registry (which I would like to avoid) or xml. Does anyone know how to easily read and write from and to xml files for settings?
  9. This works, but there has got to be a better way: DataSet DS=new DataSet(); DS.ReadXml(Org+"\\Settings\\Settings.xml"); DataRow dr = DS.Tables[0].Rows[0]; string g=(string)dr["Title"]; What if I had another parent tag with child tags the same as other parent tags? The computer would not know which one to pick!
  10. I think I found the page I was looking for: http://www.c-sharpcorner.com/Code/2002/May/SaveNRestoreFormSettings.asp
  11. My book goes over XmlTextReader but not anything like I am doing. It does not show how to get only certain tag data extracted. The Deitel and Deitel book has several examples of extracting everything!! It is kind of frustrating how there are so many examples of one thing and it is nothing that I will ever (probably) want to use!!!!!!!!!!
  12. XmlElement appearanceElement = (XmlElement)doc.GetElementsByTagName("Appearance")[0]; that one. Isn't there a less cody' way to do this using something else like XmlTextReader or XmlReader and Writer.
  13. Here is exactly what I have got: XmlDocument doc=new XmlDocument(); doc.Load(Org+"\\Settings\\Settings.xml"); XmlElement appearanceElement = (XmlElement)doc.GetElementsByTagName("Appearance")[0]; XmlElement titleColorElement = (XmlElement)appearanceElement.GetElementsByTagName("TitleColor")[0]; string g = titleColorElement.InnerText; MessageBox.Show(g); <Appearance> <Title>AndrewLog</Title> <TitleFont>blue</TitleFont> <TitleColor></TitleColor> <LogBoxColor></LogBoxColor> <LogBoxTextColor></LogBoxTextColor> </Appearance>
  14. It compiles but produces an error. Xml exception. System error.
  15. That does not work either. It will not let me put the second GetElementsByTagName there. Any you also missed the Tag before Name. Any other ideas?
  16. Thank you. That help a lot. I am probably going to use xml anyway but I will document that fact you just gave me.
  17. ChildNodes want an int in the brackets not a string value. It will not compile.
  18. I have this Xml document and I cannot find in my book anywhere about how to simply read a certain nodes information. Can someone help? <Appearance> <Title>AndrewLog</Title> <TitleFont></TitleFont> <TitleColor>blue</TitleColor> <LogBoxColor></LogBoxColor> <LogBoxTextColor></LogBoxTextColor> </Appearance> <Functuality> <SmallRTBResize>136</SmallRTBResize> <LargeRTBResize>300</LargeRTBResize> </Functuality> All I want to do is extract the settings data from the tags. Please give an example of how to get the TitleColor tags color and put in in Color variable. I tried this but it does not show anything in the message box: FileStream F=new FileStream(Org+"\\Settings\\Settings.xml",FileMode.Open); XmlTextReader reader=new XmlTextReader("Appearance/Title", F); string g=reader.ReadString(); MessageBox.Show(g); Also, please a bried explanation of how to write to that same tag.
  19. Anyone know? I really want to use a Context menu in my program.
  20. Thank you. I could not use another variable becuase they were not known to each other. But I am right though about not being able to use SR.ReadToEnd() again, right?
  21. I had a time where I created a StreamReader called SR and used it like so: string a=SR.ReadToEnd(); and then in the same file tried to use it again the same way: string b=SR.ReadToEnd(); but the second time, it never read the file and therefore put nothing in b.
  22. I see one major downfall of text files and that is that I need to create new StreamReaders every time I read the file, for example, if I wanted to read file "a" I would create a new instance of StreamReader and usually .ReadToEnd(). But if I want to read the same file again with the same stream it will not read. If I had 100 settings I would need to create 100 new StreamReaders, all with different names. Is it the same with xml?
  23. Why is XML better than just a bunch of Text files? Text files will take up less space in memory and I think are easier to open.
  24. I put in the construtor and it works great but I still do not know if that is the best way to do it or not? StreamReader sRTBRH=new StreamReader(house+"\\"+"Settings\\SmallRTBResize.txt"); try {SmallRTBResizeH=Int32.Parse(sRTBRH.ReadToEnd());} catch{SmallRTBResizeH=136;} sRTBRH.Close();
  25. I can't quite understand VB. I only know C# and C++ some. I did this and it works but I don't think it is the best way becuase I cannot seem to close the streams but it also does not seem to matter? Can someone reassure me? static StreamReader sR=new StreamReader(house+"\\"+"Settings\\SmallRTBResize.txt"); int SmallRTBResizeH=Int32.Parse(sR.ReadToEnd());
×
×
  • Create New...