Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Couple of modifications... If (OpenFileDialog1.ShowDialog() = DialogResult.OK) Then Dim x As New System.Xml.XmlDocument x.Load(OpenFileDialog1.FileName) Dim ele As Xml.XmlNodeList = x.GetElementsByTagName("EDITME") ele(0).Attributes("hTopColor").Value = "blah blah blah" If SaveFileDialog1.ShowDialog() = ShowDialog.OK Then x.Save(SaveFileDialog1.FileName) End If End If Happily loads the file and saves it out to the specified name. If you want to load with one button and save with another then declare the document at the form level rather than in the sub. I've attached a quick sample of a working version of my code. With separate Load / Save routines. WindowsApplication1.zip
  2. It will always open the file, even if you cancel out of the dialog - your if statement is just checking ShowDialog.Ok as a constant and not comparing it to any particular value. You should go with the code posted by FZelle. A dataset might help you but it can result in large memory overheads and may not be the most suitable method in this case. Have you looked at the System.Xml.XmlDocument class? Not tested the following but you would be able to load / modify and save using code similar to: If ( OpenFileDialog1.ShowDialog() == DialogResult.OK ) Then Dim x As New System.Xml.XmlDocument x.Load(OpenFileDialog1.FileName) Dim ele As Xml.XmlElement = x.GetElementById("EDITME") ele.Attributes("hTopColor").Value = "blah blah blah" x.Save("") End If
  3. Changing the scope of a single method of a form to private wouldn't prevent the public methods from being available. Protected also has a specific meaning and really is only used with inheritance, it shouldn't have any effect on your code.
  4. IIRC it is something to do with the date / time the build was performed. Personally I prefer to just set an exact build number anyway - makes it much easier to tie into a version control system.
  5. "/" should do it
  6. At least one of the following should be some help. http://www.xtremedotnettalk.com/showthread.php?t=85251 http://www.xtremedotnettalk.com/showthread.php?t=83860 http://www.xtremedotnettalk.com/showthread.php?t=81123 http://www.xtremedotnettalk.com/showthread.php?t=72328
  7. Could you post an example of what you mean?
  8. The issue is probably not to do with the compiler but for the readability of the code - some people prefer a more explicit syntax others a more terse syntax - if it wasn't for the convention of prefixing I before interfaces (despite the fact hungarian naming has been removed from everywhere else in the framework) how would you know that Employee was a class and Executive an interface? Both could be interfaces... At the end of the people can choose the language that suits them and still get the same end results - nobody is forcing people to work with a language they do not like.
  9. Easiest way is to applya style of text-align: center - best done through a stylesheet.
  10. Easiest way is through a style sheet - if you are using VB.Net then the default one does this for you. Otherwise a style like A:link { color: #3333cc; text-decoration: none; } A:hover { text-decoration: underline; color: #3333cc; } should do the trick
  11. If you have SQL then it is one of the standard tools installed.
  12. Do you mean an icon down near the clock in the bottom corner? If so then just drag a NotifyIcon component from the toolbox onto the form designer. If you wish it to have a menu the drag a context menu onto the form and associate it with the notify icon component. If on the other hand you mean something else then could you clarify your original question a bit.
  13. Not had chance to have a proper look but you have a method Private Sub DisplayText(ByVal Str As String) Try txtInfo.AppendText(Str) txtInfo.Focus() txtInfo.SelectionStart = txtInfo.Text.Length txtInfo.ScrollToCaret() txtSend.Focus() Catch MessageBox.Show("Server Error: " & Err.Number & vbCrLf & Err.Description) End Try End Sub which is updating the main form from a thread other than the main UI thread - this is generally a 'bad idea'. You should use the .Invoke method of the form to ensure it is being called on the primary thread. If you search these forums I'm fairly sure the topic has cropped up before.
  14. Could you not read the output from telnet and wait for the prompts before sending any data?
  15. Application.Exit will not call any code in a form's Closed or Closing events though - if you have validation / save logic in these events then it will be skipped. Generally it is better to close down resources when you have finished with them - if you ever get to a point when you have resources allocated that you have forgotten about then your code needs revising.
  16. XML uses the standard HTML escape sequences for characters - just replace the non supported ones with the correct escaped character. If you are using any of the built in xml support (XmlTextWriter etc) then this should be taken care of anyway.
  17. You should escape any non supported characters, for > use &gt and < for < Also your XML isn't well formed anyway as you have a space in the tag name for
  18. Or Dim MyString() As String Dim s As String = "this is a string to split" MyString = s.Split(" ") if you prefer to use the .Net methods rather than the legacy VB functions.
  19. What's not to understand? Look in the System.IO namespace for the File class, it has a method called Delete that lets you delete a file.
  20. If you are using a hyperlink control rather than just coding the link in html you can just assign a new value to it's .NavigateUrl property.
  21. http://www.xtremedotnettalk.com/showthread.php?t=92561 might be worth a read.
  22. Not sure what you are doing with the String.Format line at the end of your code. If you are trying to generate a full path using String.Format you probably want something closer to RichTextBox1.SaveFile(String.Format("E:\{0}\{1}\{2}.rtf", dayofweek , ShiftAssigned, Textbox1.Text)) I would also recomend against using the default control names - in weeks / months to come would you really have a clue what combobox23 meant?
  23. Instead of format just use .ToString(), most data types overload it to accept formating information. Dim s As String Dim i As Decimal = 5.2 s = i.ToString("C") 'or s = i.ToString("$#,##0.00") s = DateTime.Now.ToLongDateString() s = DateTime.Now.ToString("MMMM d, yyyy")
  24. Web methods return XML. Whatever data type you return is converted to SOAP and resturned. If you are building the XML yourself that will just become another node in the result document. What kind of information are you returning and if it has a particular structure could you not define a valid schema for it and let .Net do some of the work?
  25. If you application isn't exiting it usually means you have not closed down all forms you opened or threads you started. Are you providing an exit button for the users? If so how are you handling the shutdown there?
×
×
  • Create New...