Jump to content
Xtreme .Net Talk

Machaira

Avatar/Signature
  • Posts

    330
  • Joined

  • Last visited

About Machaira

  • Birthday 08/22/1966

Personal Information

  • Occupation
    Programmer
  • Visual Studio .NET Version
    VS.NET Enterprise
  • .NET Preferred Language
    VB.NET, C#

Machaira's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Sure, why not.
  2. You should be able to use the code I gave in post #4, you just need to take the namespace into account. Maybe I'm just missing something about exactly why you're trying to do it the way you're doing it. :(
  3. Public Class EmployeeAdder <XmlAttribute("KronosID")> _ Public KronosID As Int32 = 0 <XmlAttribute("Name")> _ Public Name As String = String.Empty <XmlAttribute("ActivityID")> _ Public ActivityID As Int32 = 0 End Class Since you're not doing any validation in the property accessors just make the members public. I still don't understand the reasoning behind making things more difficult than you need to.
  4. If you're using an XML format that the serializer can use you can't use serialization. Since you've already go the XMLDocument object you should just be able to iterate through the nodes and populate the properties of an employee object. I think you're making it harder than it needs to be by introducing things like the stream and XmlTextReader. Try this: Dim lst As New List(Of EmployeeAdder) Dim emp As EmployeeAdder Dim doc As New Xml.XmlDocument Dim node As Xml.XmlNode doc.Load(Application.StartupPath & "\test.xml") For Each node In doc.DocumentElement emp = New EmployeeAdder emp.ActivityID = Convert.ToInt32(node.SelectSingleNode("descendant::ActivityID").InnerText) emp.ID = Convert.ToInt32(node.SelectSingleNode("descendant::ID").InnerText) emp.Name = node.SelectSingleNode("descendant::Name").InnerText lst.Add(emp) Next node If you have to have the "xmlns="http://www.me.com", you'll need to add the code to recognize it.
  5. You're trying to deserialize a list of objects into a single object. It seems list you're also using XML that you created, not XML created by the serialization process. Try: Dim lst As New List(Of EmployeeAdder) Dim ser As New Xml.Serialization.XmlSerializer(GetType(List(Of EmployeeAdder))) Dim reader As New System.IO.StreamReader(New System.IO.FileStream(Application.StartupPath & "\test.xml", IO.FileMode.Open)) lst = CType(ser.Deserialize(reader), List(Of EmployeeAdder)) using XML formatted like this: <?xml version="1.0" encoding="utf-8"?> <ArrayOfEmployeeAdder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <EmployeeAdder> <ID>1</ID> <Name>Test</Name> <ActivityID>1</ActivityID> </EmployeeAdder> <EmployeeAdder> <ID>2</ID> <Name>Test 2</Name> <ActivityID>2</ActivityID> </EmployeeAdder> </ArrayOfEmployeeAdder>
  6. All you ever wanted to know about connection strings - http://www.connectionstrings.com
  7. Google is your friend - http://www.mvps.org/access/queries/qry0002.htm :)
  8. You can't really have any "best practice" guidelines because there's not one set way to do those things. The Standard Items in the menubar and toolbar don't know anything about how data will be input. How you disable/enable those controls depends on how you're inputting data. It could be the keyboard, it could be an on-screen keyboard with a mouse or other controller, it could be voice recognition software, etc.
  9. The problem is, the menu items don't know what events will trigger them being enabled or disabled. It depends on the application. You'll have to handle catching the events for enabling/disabling the items in whatever control you're using with that functionality.
  10. Requery the database for the set of employees you want to view.
  11. You'll have to have the event code written already, but then you would just do: AddHandler myButton.Click, AddressOf btnTest1_click
  12. Why not use the app.config file then?
  13. Any time. :)
  14. 1. http://www.google.com/search?q=c%23+tutorials&rls=com.microsoft:en-us&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1 2. See above :) 3. I didn't find it to be hard at all
  15. Ahh, I didn't see that. Looks like that should work, thanks!
×
×
  • Create New...