Today in the class of Monday the 30th of May we covered the connection of the data control to data-source. We talked about the GUI control and component concepts.
Todd showed us how to use a data grid view to display data from the database on the Windows Form.
Both David and I followed Todd’s method exactly but both got the same error after selecting the database to connect to (after checking the database connection which was successful) but after selecting a table and pressing the “Finish” button we got a error (see below screenshot:
Both David and I checked our connection string to the database with Todd and it was identical. Everything else was identical between our computer except I had an updated version of Visual Studio, but David didn’t.
I also believe that I had everything the same as Jonathan who had easily connected the data grid view to the database and was now playing around with inserting data to the database which was then displayed on the data grid view.
Aaron and DJ also easily connected to their database from with the data grid view, so it seemed that for some completely unknown reason only David and I had this problem.
Todd suggested we got the updated MySQL plugin for Visual Studio, which I will try to do this evening.
Class Notes summarizing whats needed for DAT602 Milestone 3:
There are two features we will implement in our game for the milestone 3, graphical control, and component.
A graphical control is some representation of system that allows you to control something. The prime example of this is the button, when you click on it ti does something. A control is a representation of physical switches, button, etc.
Therefore a graphical control can be anything you can interact with and it will do something.
Whilst a component is a reusable chunk of mechanism that has various types of interfaces in it that will let the system integrate itself in a IDE. The component doesn’t necessarily have a GUI parts to it.
So control is a specialization of a component.
A component can be interrogated by IDE to provide you by what facilities are available for that particular component.
We watched a video on using the data grid, here’s what I got out of the video:
For MS3 we will make a graphical version of the system, we will make a windows form application. Take a button, labels and textbox and then drag and drop in the data sub menu and select the data grid control.
Select the data grid control and the triangle on top right corner it allows you to manipulate the grid. Select “Choose data source”
Do no enable the “Enable adding” or “Enable editing”.
Then double click the button, to create the button event handler which produces code you see, and then there is manipulated code manipulated by GUI .Write:
Inside the brackets we write the number of columns the data grid view will show (i.e. number of columns in the data grid view). So when you add data to the form the data is shown in the data grid view columns, this only adds data to local system it is not connecting to the database.
In our game we will need a timer, but is a timer a control or a component. The timer is a component as it doesn’t have a representation on the form, even though it has a event the ‘tick’ associated with it it isn’t represented on the GUI.
The timer is a component that will be made with a from at the same time as the controls of the form.
We will need a timer for your game because you can do a refresh on a timer. A timer will allow you to check if there has been changes in the game since you last did something.
Timer is recommended to ‘tick’ 5 times per second. As the timer property is set in millisecond then specify it ‘tick’s every 200 milliseconds. When you join the game your timer starts.
Anytime when something happens it goes to the server, it doesn’t get back pulled down again until the UpdateDisplay() method is called by the timer which has a period of time 200 milliseconds between ‘ticks’
Between every 200 milliseconds a method UpdateDisplay() it will go to the database and grab the the new location of the moving object for display on the GUI, but to make the game fair every time a control is selected in the UpdateDisplay() method is called pulling the new location for the GUI for both users. You also have the Timer component call the UpdateDisplay() method every 200 millisecond
If each users display is updated every 200 milliseconds then the longest possible time between two different users updates is 100 milliseconds.