Okay this is what I'm working on. This program keeps track of Linkshell[Guild] mates in the game Final Fantasy XI. Points are given for attendance. I want to add bulk points to many members via a check box, but for some reason it only adds points to the person I have selected. Code a picture below:
The Person class:
Any idea ><?
If this isnt enough info post here or send me an email at t2small AT yahoo DOT com and I can send you the sorce code.
VB.NET:
Imports System.IO
Imports System.Xml
Imports System.Data
Imports System.Windows.Forms
Public Class Home
Inherits System.Windows.Forms.Form
Dim personEditing As Person
Dim idEditing As Integer = -1
Dim eventEditing As Person2
Dim Warnings As Double = 1
Dim var1 As Double
Dim var2 As Double
Dim var3 As Double
Dim var4 As Double
Dim Math1 As Double
Dim Math2 As Double
Dim Math3 As Double
Dim math4 As Double
Sub SaveList2()
If lstInfo.Items.Count > 0 Then
Dim users(chkbox1.Items.Count - 1) As Person
chkbox1.Items.CopyTo(users, 0)
Dim objSW As System.IO.StreamWriter
objSW = New System.IO.StreamWriter("Members.xml", False)
Dim x As New System.Xml.Serialization.XmlSerializer(users.GetType)
x.Serialize(objSW, users)
x = Nothing
objSW.Close()
objSW.Dispose()
End If
End Sub
Sub ReadList2()
If System.IO.File.Exists("Members.xml") Then
chkbox1.Items.Clear()
Dim users() As Person
Dim sInput As String = System.IO.File.ReadAllText("Members.xml")
Dim clsStream As New System.IO.MemoryStream()
clsStream.Write(System.Text.ASCIIEncoding.ASCII.GetBytes(sInput), 0, sInput.Length)
clsStream.Position = 0
Dim objSR As New System.Xml.XmlTextReader(clsStream)
Dim x As New System.Xml.Serialization.XmlSerializer(GetType(Person()))
users = x.Deserialize(objSR)
x = Nothing
objSR.Close()
If users.Length > 0 Then
For intA As Integer = 0 To users.Length - 1
chkbox1.Items.Add(users(intA))
Next intA
End If
End If
End Sub
Private Sub chkbox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkbox1.SelectedIndexChanged
If chkbox1.SelectedIndex > -1 Then
Dim box As CheckedItemCollection
box = chkbox1.CheckedItems
idEditing = chkbox1.SelectedIndex
personEditing = CType(chkbox1.SelectedItem, Person)
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
var2 = personEditing.Points
var3 = TextBox3.Text
var2 = var2 + var3
personEditing.Points = var2
Call SaveList()
Call ReadList()
End Sub
End Class
VB.NET:
<Serializable()> _
Public Class Person
Public Name As String
Public MainJob As String
Public SubJob As String
Public Secondary As String
Public Warning As String
Public COP As String
Public Zilart As String
Public ToAU As String
Public Fishing As String
Public Woodworking As String
Public Smithing As String
Public Goldsmithing As String
Public Clothcraft As String
Public Leathercraft As String
Public Bonecraft As String
Public Alchemy As String
Public Cooking As String
Public Points As String
Public Email As String
Public Math1 As String
Public Comments As String
Public IsALeader As String
Public Crafting As String
Public Trial As String
Public MemberStat As String
Public Status As String
Public Comments2() As String
Public Overrides Function ToString() As String
Return Name & Status
End Function
End Class
If this isnt enough info post here or send me an email at t2small AT yahoo DOT com and I can send you the sorce code.