saving changes from diffrent users to the network so everyone can see and contribute VB 2010
Using Visual Basic 2010!!
So I am working on a small program that will tell the engineers the status of their testers; whether they are up or down with the time and date in addition there is also a comment box. I have created a program that has all the right buttons and options. Where I am stuck is on the save option. I want the engineers to be able to make changes to the status/date/comments and by clicking the save button to save all changes(in the status and date boxes) and text(in the comment box) so that when the program is opened at a later time or by another user on the network from a diffrent work station the latest changes from whomever will be present. The code that follows only allows the changes to be seen by on that specific computer and they are not shared to everyone who uses the program that accesses it over the network. Any help would be awsome!! Hope this is clear!
How can I get it so everyone sees all changes over the network regardless of the computer they are using? any help would be amazing!!
Public Class Form1
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs开发者_开发百科)
End Sub
Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub closeButton_Click_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeButton_Click.Click
' is there a save function or close and save
Close()
' Me.SaveMySettingsOnExit = True
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SaveFileDialog1.ShowDialog()
End Sub
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
Dim FileToSaveAs As String = SaveFileDialog1.FileName
Dim objwriter As New System.IO.StreamWriter(FileToSaveAs)
'label5 is et100 combobox1 is up/down textbox1 is comment box for et100
objwriter.Write(Label5.Text)
objwriter.Write(ComboBox1.Text)
objwriter.Write(DateTimePicker1.Text)
objwriter.Write(TextBox1.Text)
objwriter.Close()
End Sub
- pretty rough but this is the over all idea.
Use a central database like Sql Server Express or MySql or maybe even something like CouchDB or MongoDB to store all the information. Then change your application to connect to the database to read and write the records and it doesn't matter where it is run.
You're going to have to use some sort of database to do what you are trying to accomplish. Having everyone who is using that application read/write to a single flat file is definitely a no no. You'll encounter many issues related to concurrent users accessing this file.
Since you're already using vs 2010, you could install Sql Server Express (free - 2008 R2 edition has it's size limitations upgraded to 10 GB)
You'll also have to read up on how to interact with the database. You could read up on Entity Framework (Microsoft's ORM tool) here: http://msdn.microsoft.com/en-us/library/bb399182.aspx Kind of simplifies data access but also introduces some complexity to your applications.
Alternatively, you could read up on ADO.NET... This might be easier for you to get started on if you find the Entity Framework too complicated
Tons of examples on line (google is your friend).
There is a lot of information to be found online.
精彩评论