Creating A Program Using Visual Studio Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

To establish a connection with the Arc ascii raster grid file via the path specifying its location in the computer system memory. This path has to be typed correctly in the required TextBox control.

To open the rasterinput.asc file and read the gridded elevation data.

To store the data obtained from rasterinput.asc in data structures (e.g arrays) so that the data can be processed and displayed as a colour coded raster in a PictureBox control.

To establish a connection with the comma separated point file (temperature.csv) via the path specifying its location in the computer system memory. This path also has to be typed correctly in the required TextBox control.

To open the temperature.csv file and read the point data.

To store the data obtained from temperature.csv in an array so that the data can be processed and displayed graphically via a PictureBox control.

To achieve these requirements in the program, the program was written based on the structure described below:

To Read in the Arc ascii raster grid file (rasterinput.asc)

The user clicks the button to read in the file (rasterinput.asc).

The file path initially entered by the user in the textfield (txtInputRasterFil) is checked to see if it is a valid path ( i.e if the file specified by the path actually exists in memory). This check is performed after the function open_raster_file( ) is called.

If the file exists, a connection is made to open and read in the file else a Message Box appears prompting the user to enter an existing file name.

If the file exists (as indicated by a boolean value of true for variable ExistFlag), the program begins to read in the streams of data from the file into a string variable called strRasterDisplay which is also assigned some predefined text describing the data output to the user.

For the first 6 lines of data received, 6 space separated pairs of data are extracted from the file and appended to the string variable strRasterDisplay. These data pairs are splitted by empty space (white space character) and they represent important data values indicating the number of columns, number of rows, xllcorner, yllcorner, cell size and the no data value for the elevation data in the rasterinput.asc that has been opened.

From the 7th line of data till the last line, the program reads in numerical values (of type long) of the gridded elevation data. The number of values read per line is determined by the value of number of columns (read from the first line of data received and in the present case is 20). The 20 numerical values per line are separated by empty space (the white space character), which splits them and stores them in an array called rasterInputArray that stores the gridded elevation data received. The values are converted to type string and appended to String variable strRasterDisplay. This procedure is iterated till the last line of the gridded elevation data.

After the entire data stream has been read as described above, the String variable strRasterDisplay which contains all the data read is displayed as text in the TextBox txt1Caption. The command button cmdDispElevData is also enabled.

To display the gridded elevation data in a PictureBox

The scale of the required PictureBox (picRasterDisp) is set. This is done with consideration to the values obtained for the number of rows and number of columns from rasterinput.asc

The maximum value of the grid elevation data which is stored in the array (rasterInputArray) is obtained. This is done by iterating through all the elements of the array and comparing data until the maximum value is obtained.

The gridded elevation data is displayed as a colour coded raster in the PictureBox (picRasterDisp). If a no data value exists for an element of the array, a blue line is used to represent it, else all other elements are represented by finding their proportion with respect to the maximum value obtained and using a scale of 255 to determine their colour values. The variable dispControl is used to find the proportion value as shown in the code and the colour value is set as RGB (0, dispControl, dispControl).

To Read the comma separated point file (temperature.csv)

The user clicks the button to read in the file (temperature.csv)

The file path initially entered by the user in the textfield (txtInputPointFil) is checked to see if it is a valid path ( i.e if the file specified by the path actually exists in memory). This check is done after the function open_point_file() is called.

If the file exists, a connection is made to open and read in the file else a Message Box appears prompting the user to enter an existing file name.

If the file exists (as indicated by a boolean value of true for variable ExistFlag), the program begins to read in the streams of data from the file. Each line consists of a comma seperated list of 3 numerical values. They are splitted and separated via a comma (,) character, converted to type double and then stored in 3 separte array variables. This process is carried out till the last line of data available in the file has been extracted.

The data obtained is converted to a string format and appended to a String variable (strPointDisplay). The TextBox (txt2Caption) is enabled and strPointDisplay is appended to the textBox so that a text display of the data obtained can be viewed. The command buttons to display the point data in the pictureBox (cmdDispPointData and cmdDispElevAndPoint) are then enabled.

To display the Point data in a PictureBox

The scale of the required PictureBox is set. This is done with consideration to the values obtained from the point value. The maximum and minimum values were noted and appropriate bound values were chosen

The colour values for the data elements obtained from the 3rd column are set based on the values. (Values greater than 15 have their FOreColor property set to blue and all other data values have their ForeColor property set to red.

The point data is displayed using data values obtained from the first two columns to set the coordinates and the corresponding value in the third column to display the point data at each coordinate with the different colours indicating the values. picPointDisp.Pset( ) and picPointDisp.Print( ) are used to control the display.

To display the Point data on Elevation data in the same PictureBox

Two boolean variables (pointCheck and elevCheck) are checked to determine if both the gridded elevation data and point data have been properly extracted from the respective files. These variables are appropriately set after the array variables have been updated when the files are read from the files.

If the boolean variables are set to true, the point data would be displayed on the same PictureBox for the gridded elevation data i.e picRasterDisp via the same procedure described above to display the point data, else if the boolean variables are set to false, a message box appears informing the user to read in all data required.

Flowcharts: From the description of the program requirements above, the following flowcharts were developed before the program was generated:

point data is displayed in picture box

raster data is displayed in picture box

user clicks on command button to display point data over raster data

point data is displayed over raster data in picture box

user clicks on clear all command button

All screens are cleared

user clicks on Exit command button

End

point file exits?

user clicks on command button to display point data

user clicks on command button to display raster data

open file, read and store data stream and command button is enabled

open file, read and store data stream and command button is enabled

raster file exits?

user asked to change path

user asked to change path

Start

load Form, set enable status defaults for controls

user enters file path to read in temperature.csv and command button is enabled

user enters file path to read in rasterinput.asc and command button is enabled

user clicks on command button to read file

user clicks on command button to read file

Yes

Yes

No

No

General Flowchart for the Program:

Flowchart for reading raster file

user clicks command button to read file

No

Yes

raster file exists?

message box appears asking user to make valid input

connect to file, open text stream

read in each line of string data from file, i = 0

user enters new file path

No

Yes

i < = 5?

split meta data into 2 tokens, assign data to string and long arrays

i = i + 1

declare rasterInputArray with dim from meta data

split data into tokens det. by meta data value for nos. of columns & update raster array. i = i + 1

No

Yes

reached last line of data?

Close text stream, enable command button for display, set text box to display data read as text

End

Flowchart for reading point file

user clicks command button to read point file

No

Yes

raster file exists?

connect to file, open text stream, i = 0

message box appears asking user to make valid input

read in each line of string data from file,

user enters new file path

split meta data into 3 tokens, assign data to 3 arrays for each column, and update string with array values

i = i + 1

reached last line of data?

No

Yes

Close text stream, enable command button for display, set text box to display data read as text

End

Flowchart to display elevation raster data in picture box

user clicks command button to diplay raster data

set scale of picture box, det. max value of raster array, i = 0

loop through raster array

is array data = no data value?

Yes

No

set the display to show a blue line, i = i + 1

calc. colour property based on proportion of array data to max. value then set colour value.

i = i + 1

reached last line of data?

No

Yes

display raster data as colour coded raster

End

Flowchart to display point data in picture box

user clicks command button to diplay point data

Set appropriate scale for picture box to contain all data available, i = 0

loop through data in array from 3rd column

is data > 15?

No

Yes

set ForeColor property of picture box to red, i = i + 1

set ForeColor property of picture box to blue, i = i + 1

reached last line of data?

No

Yes

Display point data using data in first two arrays as coordinates and data in 3rd array as point value

End

Flowchart for displaying point data over raster data in same picture box

user clicks command button to diplay point data over raster data

check boolean flags that are set to true only when both point data and raster data have been read

Are both boolean flags true?

No

Yes

message box informs user to ensure all data has been read in

display point data over raster data as described in previous flow charts

Perform process of reading point data described in flowchart above

User reads in data and boolean flags are set to true

Program Design

Fig 1: Object view of the Program

As can be seen from the object view of the program shown above, the following controls were used to implement the GUI:

Forms:

One form (Form1) was used for the program. All components were added to the form.

Labels:

titleLabel: This label was used to display the title of the program

lblReadRasterFil: This label was used to direct and guide the user on how to read the raster input file

lblReadPointFil: This label was used to direct and guide the user on how to read the point data file.

TextBoxes:

txtInputRasterFil: This textbox was used to receive the user input for the file path for rasterinput.asc.

txtInputPointFil: This textbox was used to receive the user input for the file path for temperature.csv

txt1Caption: This textbox was used to display the text showing data obtained from rasterinput.asc. It is locked and cannot be edited by the user

txt2Caption: This textbox was used to display the text showing data obtained from temperature.csv. It is locked and cannot be edited by the user

Command Buttons

cmdReadRasterFilData: This command button’s enable property is set to False by default and is enabled when the user starts entering text in the text box txtInputRasterFil. When clicked, it activates the process of reading the rasterinput.asc file.

cmdReadPointFilData: This command button’s enable property is set to False by default and is enabled when the user starts entering text in the text box txtInputPointFil. When clicked, it activates the process of reading the temperature.csv file.

cmdDispElevData: This command button is used to activate the process of displaying the gridded elevation data in the picture box, picRasterDisp. Its enable property is set to False by default and it is enabled when data obtained is displayed in the textbox txt1Caption.

cmdDispPointData: This command button is used to activate the process of displaying the point data in the picture box, picPointDisp. Its enable property is set to False by default and it is enabled when data obtained is displayed in the textbox txt2Caption.

cmdDispElevAndPoint: This command button is used to activate the process of displaying the point data in the same picture box as the elevation data, i.e picRasterDisp. It is activated when data has been retrieved from both rasterinput.asc and temperature.csv and also text displayed in txt1Caption and txt2Caption.

cmdClearAll: This command button is used to the display in all the text boxes and picture boxes to allow the user re-enter the data

cmdExit: This command button is used to exit and close the program.

Picture Boxes:

picRasterDisp: This picture box is used to display the gridded elevation data as a colour coded raster. It can also be used to display the point data on the gridded elevation data.

picPointDisp: This picture box is used to display the point data on the specified coordinates using two colours (blue and red) depending on the values.

The various sub functions of the code are shown below:

Form_Load ( )

txtInputRasterFil_Change ( )

txtInputPointFil_Change ( )

open_raster_file ( )

open_point_file ( )

cmdReadRasterFilData_Click ( )

cmdReadPointFilData_Click ( )

cmdDispElevData_Click ( )

cmdDispPointData_Click ( )

cmdDispElevAndPoint_Click ( )

cmdClearAll_Click ( )

cmdExit_Click ( )

Program Codes:

The documented code is shown below:

Option Explicit

' These are file related objects from the Microsoft runtime

' library required to support the file processes

'The next three lines of code were written based on idea obtained

'from previous examples in the lecture material

Private chjFileSysObj As New FileSystemObject

Private chjFile As File

Private chjTextStream As TextStream

'Declaring Global variables (variables that would be called

' and used by various functions)

Dim strVarArray(6) As String

'This array holds the values of the String variable names

' for the first 6 lines of data read from the raster file

Dim varArray(6) As Long

'This array holds the 6 Long variable values obtained from

' the first 6 lines of data read from the raster file

Dim strNumCols, strNumRows, strxllCorner, stryllCorner, strCellSize, strNoDataValue As String

Dim numOfColumns, numOfRows, xllCornerValue, yllCornerValue, cellSize, noDataValue As Integer

'The variables declared above are the data for the first 6

' lines of data read from the raster file

Dim strRasterDisplay As String

'The String value above stores data retrieved from the raster file

Dim strPointDisplay As String

'The String value above stores data retrieved from the point file

Dim rasterInputArray() As Long

'The long values obtained from the raster file are stored in the

' array rasterInputArray()

Dim count1, count2 As Integer

'The variables count1 and count2 are used to iterate the array

' elements of rasterInputArray()

Dim maximumValue As Long

'The variable declared above is used to store the maximum value in the rasterInputArray

Dim pointCheck, elevCheck As Boolean

'The Boolean variables declared above are used to control grid elevation and point display

Dim col1(50), col2(50), col3(50) As Double

'The Arrays declared here are used to store the data obtained from the point file

Dim pointCount As Integer

'The variable above is used to control display of point data

Private Sub Form_Load()

'The following properties are set when the program is run and the form

'is loaded. some command buttons and text boxes

'are disabled until when needed based on the user input

txt1Caption.Enabled = False

txt2Caption.Enabled = False

cmdReadRasterFilData.Enabled = False

cmdReadPointFilData.Enabled = False

cmdDispPointData.Enabled = False

cmdDispElevData.Enabled = False

cmdDispElevAndPoint.Enabled = False

pointCheck = False

elevCheck = False

End Sub

Private Sub txtInputPointFil_Change()

'This is used to enable the command button below only after

'the user begins entering input in txtInputPointFil text box

cmdReadPointFilData.Enabled = True

End Sub

Private Sub txtInputRasterFil_Change()

'This is used to enable the command button below only after

' the user begins entering input in txtInputRasterFil text box

cmdReadRasterFilData.Enabled = True

End Sub

Private Sub open_raster_file(ExistFlag As Boolean)

'This function is called when the user clicks the button to attempt to open the raster file

'This checks to see if the path entered by the user is valid

'The next seven lines of code were written based on idea obtained

'from previous examples in the lecture material describing how to open a file

ExistFlag = chjFileSysObj.FileExists(txtInputRasterFil.Text)

If ExistFlag Then

' The file is obtained and stored in chjFile

Set chjFile = chjFileSysObj.GetFile(txtInputRasterFil.Text)

'A textstream is opened so as to commence reading from the file

Set chjTextStream = chjFile.OpenAsTextStream(ForReading)

Else

'A message box is displayed to notify the user of an invalid input

MsgBox "File does not exist, Pls enter an existing file name!"

End If

End Sub

Private Sub open_point_file(ExistFlag As Boolean)

'This function is called when the user clicks the button to attempt to open the raster file

'This checks to see if the path entered by the user is valid

'The next seven lines of code were written based on idea obtained

'from previous examples in the lecture material describing how to open a file

ExistFlag = chjFileSysObj.FileExists(txtInputPointFil.Text)

If ExistFlag Then

' The file is obtained and stored in chjFile

Set chjFile = chjFileSysObj.GetFile(txtInputPointFil.Text)

'A textstream is opened so as to commence reading from the file

Set chjTextStream = chjFile.OpenAsTextStream(ForReading)

Else

'A message box is displayed to notify the user of an invalid input

MsgBox "File does not exist, Pls enter an existing file name!"

End If

End Sub

Private Sub cmdReadRasterFilData_Click()

'This is triggered by the user clicking the cmdReadRasterFilData

' command button to begin reading the raster file

Dim ExistFlag As Boolean

Dim in_string As String

'This is a dynamic array used to receive input from the raster file

Dim token_array() As String

Dim i As Integer

i = 0

' To check if the file exists, establish a connection if it does and open the file

Call open_raster_file(ExistFlag)

If ExistFlag Then

'The loop below is executed if the file is opened

Do Until chjTextStream.AtEndOfStream

'Each line from the file is read into in_string

in_string = chjTextStream.ReadLine

'This displays an initial text on the screen acting as

' a guide to explain the text to be displayed

If i = 0 Then

strRasterDisplay = "The first 6 lines of meta data read from the raster "

strRasterDisplay = strRasterDisplay + "file is shown below: " + vbNewLine + vbNewLine

End If

'The first 6 lines of data contain information ( meta data )

' about the gridded elevation data in the remaining lines

'This data in the first 6 lines is extracted and stored in

' the variables and arrays shown below

If i <= 5 Then

token_array = Split(in_string, " ", 2)

strVarArray(i) = token_array(0)

'The string values are extracted directly to the token array

varArray(i) = CLng(token_array(1))

'The numerical values are converted to long using CLng

strRasterDisplay = strRasterDisplay + strVarArray(i) + " = "

strRasterDisplay = strRasterDisplay + Str$(varArray(i)) + vbNewLine

'Assign values retrieved to variables by obtaining

' form the appropriate array element

strNumCols = strVarArray(0)

strNumRows = strVarArray(1)

strxllCorner = strVarArray(2)

stryllCorner = strVarArray(3)

strCellSize = strVarArray(4)

strNoDataValue = strVarArray(5)

numOfColumns = varArray(0)

numOfRows = varArray(1)

xllCornerValue = varArray(2)

yllCornerValue = varArray(3)

cellSize = varArray(4)

noDataValue = varArray(5)

End If

'All meta data (from the first 6 lines have been extracted.

'So its time to start extracting the main raster data

If i = 6 Then

'Based on the information obtained from the meta data,

' the dimensions of the rasterInputArray which holds the raster data is set

ReDim rasterInputArray(numOfRows, numOfColumns)

'The String which shows the text output is updated accordingly

strRasterDisplay = strRasterDisplay + vbNewLine

strRasterDisplay = strRasterDisplay + "The main data from the raster input file"

strRasterDisplay = strRasterDisplay + "is shown below:" + vbNewLine + vbNewLine

End If

'For all the remaining lines, the raster input data is

' extracted based on the separation character (,)

If i > 5 Then

token_array = Split(in_string, " ", numOfColumns)

'numOfColumns obtained from meta data is used to control the splitting and storing of data

For count2 = 0 To (numOfColumns - 1)

rasterInputArray(count1, count2) = CLng(token_array(count2))

strRasterDisplay = strRasterDisplay + Str$(rasterInputArray(count1, count2))

Next

strRasterDisplay = strRasterDisplay + vbNewLine

count1 = count1 + 1

End If

' This increments the loop so that the process can be carried out on the next line

i = i + 1

Loop

count1 = 0 'count1 is reinitialized

chjTextStream.Close

'The stream is closed after file extraction has been completed

cmdDispElevData.Enabled = True

'The command button to activate display of elevation data is enabled

txt1Caption.Enabled = True 'The text box to display text data is activated

elevCheck = True

End If

txt1Caption.Text = strRasterDisplay

'String variable strRasterDisplay which has been used to store

' data obtained is appended to the text box for text display

End Sub

Private Sub cmdReadPointFilData_Click()

'This is triggered by the user clicking the cmdReadPointFilData

' command button to begin reading the point file

Dim ExistFlag As Boolean

Dim in_string As String

'This is a dynamic array used to receive input from the point file

Dim token_array() As String

Dim i As Integer

i = 0

'This displays an initial text on the screen acting as a guide

'to explain the text to be displayed

strPointDisplay = "The data read from the point file is shown below: " + vbNewLine

' To check if the file exists, establish a connection if it does and open the file

Call open_point_file(ExistFlag)

If ExistFlag Then

'The loop below is executed if the file is opened

Do Until chjTextStream.AtEndOfStream

'Each line from the file is read into in_string

in_string = chjTextStream.ReadLine

'The string is split into tokens, each stored in the three arrays shown below

token_array = Split(in_string, ",", 3)

col1(i) = CDbl(token_array(0))

col2(i) = CDbl(token_array(1))

col3(i) = CDbl(token_array(2))

'The string for text display is updated for all data retrieved.

strPointDisplay = strPointDisplay + Str$(col1(i)) + " "

strPointDisplay = strPointDisplay + Str$(col2(i)) + " " + Str$(col3(i)) + vbNewLine

' This increments the loop so that the process can be carried out on the next line

i = i + 1

Loop

chjTextStream.Close 'the text stream is closed after data has been read

pointCount = i - 1

txt2Caption.Enabled = True

' the text box to display text data from the string is enabled

txt2Caption.Text = strPointDisplay

'value of strPointDisplay is appended to the text box to display text showing point data

cmdDispPointData.Enabled = True

'the command button to be clicked to display point data is enabled

cmdDispElevAndPoint.Enabled = True

'the command button to be clicked to display point data on elevation data is enabled

pointCheck = True

End If

End Sub

Private Sub cmdDispElevData_Click()

'this is triggered when the user clicks the command button to display elevation data

picRasterDisp.Scale (0, 0)-(numOfColumns, numOfRows)

'setting the scale for the picture box using number of columns and number of rows obtained form the raster file

picRasterDisp.Cls 'the screen is refreshed

Dim dispControl As Long

Dim i, j As Integer

'the code below is used to determine the maximum value of the data values from the raster file

maximumValue = rasterInputArray(0, 0)

'the code below iterates through all the array elements and finds the maximum value

For i = 0 To numOfRows - 1

For j = 0 To numOfColumns - 1

If ((rasterInputArray(i, j)) <> (noDataValue)) Then

If ((rasterInputArray(i, j)) > (maximumValue)) Then

maximumValue = rasterInputArray(i, j)

End If

End If

Next

Next

For i = 0 To numOfRows - 1

For j = 0 To numOfColumns - 1

'This checks to see if the value is the no data value

If ((rasterInputArray(i, j)) = noDataValue) Then

' the line property is used to indicate the presence of no data value with a blue line

picRasterDisp.Line (j, i)-Step(1, 1), RGB(0, 0, 255), BF

Else

'the dispControl variable is used to calculate the colour for each data

'based on its proportion with the maximum value but restricted to the scale

'of 255 which is the maximum colour value

dispControl = ((rasterInputArray(i, j)) / ((maximumValue)) * 255)

'the line property of the picture box is used for the display using

'the variable calculated above i.e dispControl in RGB (0, dispControl, dispControl)

picRasterDisp.Line (j, i)-Step(1, 1), RGB(0, dispControl, dispControl), BF

End If

Next

Next

End Sub

Private Sub cmdDispPointData_Click()

'this is triggered when the user clicks on the command button to display point data

Dim j As Integer

'Based on the values obtained from the point data, the scale for picPointDisp picture box is set below

picPointDisp.Scale (400000, 500000)-(500000, 400000)

'other properties of the picture box are also set below

picPointDisp.DrawWidth = 5 'this sets the drawWidth of the picture box

picPointDisp.DrawStyle = 2 'this indicates a dot as the drawStyle of the picture box

'two colours (red and blue) are used to display the coloured point data based on size

For j = 0 To pointCount

If col3(j) > 15 Then

picPointDisp.ForeColor = vbBlue

Else

picPointDisp.ForeColor = vbRed

End If

'The point data is displayed using the first two columns to set the coordinates

' and the last column for the corresponding point data value

picPointDisp.PSet (col1(j), col2(j))

picPointDisp.Print CStr(col3(j))

Next

End Sub

Private Sub cmdDispElevAndPoint_Click()

'This is triggered when the user clicks the cmdDispElevAndPoint button

' to display the point data on the gridded elevation data in the same picture box

'a test is conducted to check if the values are read and ready to be displayed

If pointCheck = True And elevCheck = True Then

Dim j As Integer

'Based on the values obtained from the point data, the scale for picPointDisp picture box is set below

picRasterDisp.Scale (400000, 500000)-(500000, 400000)

'other properties of the picture box are also set below

picRasterDisp.DrawWidth = 5

picRasterDisp.DrawStyle = 2

'two colours (red and blue) are used to display the coloured point data based on size

For j = 0 To pointCount

If col3(j) > 15 Then

picRasterDisp.ForeColor = vbBlue

Else

picRasterDisp.ForeColor = vbRed

End If

'The point data is displayed using the first two columns

'to set the coordinates and the last column for the corresponding point data value

picRasterDisp.PSet (col1(j), col2(j))

picRasterDisp.Print CStr(col3(j))

Next

Else

'if any of the data values are not yet read from the

' files the message box below notifies the user

MsgBox "Please read in Point Data and Elevation Data"

End If

End Sub

Private Sub cmdClearAll_Click()

'this is triggered when the user clicks the cmdClearAll

' command button to clear the screen

'the strings are cleared, while the textboxes and command buttons are disabled

strRasterDisplay = ""

txt1Caption.Text = strRasterDisplay

strPointDisplay = ""

txt2Caption.Text = strPointDisplay

txtInputRasterFil.Text = ""

txtInputPointFil.Text = ""

picPointDisp.Cls

picRasterDisp.Cls

cmdReadRasterFilData.Enabled = False

cmdReadPointFilData.Enabled = False

cmdDispElevData.Enabled = False

cmdDispPointData.Enabled = False

cmdDispElevAndPoint.Enabled = False

pointCheck = False

elevCheck = False

End Sub

Private Sub cmdExit_Click()

'this is triggered when the user clicks the cmdExit button

'and it causes the program to be closed.

End

End Sub

Screen Shots of program

The following figures shown below show screen shots of the program when run. Different stages of interaction with the user are shown and described below:

Program is run and Form is loaded: As can be seen below, only two text boxes (to input the file paths) and two command buttons (Exit and Clear All) are enabled. The others are only going to be enabled gradually as the user starts entering data. The user is expected to enter the file path specifying either rasterinput.asc or temperature.csv. The labels inform the user on what to do.

Fig 2: Form is loaded when program is run

User begins typing value of path in text box: As can be seen in the figure below, the user has begun entering the file path for the rasterinput.asc (in this case is C:\Users\Dell\Desktop\Short Assignment Solution\rasterinput.asc). The command button which when clicked commences reading of the specified file is now enabled.

Fig 3: User begins entering file path for raster file

User clicks on command button to read file: The user has clicked on the command button to read in the file and the data values obtained from the raster file are displayed in the text box shown as seen in the diagram below:

Fig 4: User reads in raster file data

User enters file path for point data in text box: Here the user enters the path for the file (temperature.csv) which is the point file to be read. The command button to read in the file is enabled as the user inputs the path:

Fig 5: User enters file path for point data

User clicks command button to read in temperature.csv: The comma separated point file (temperature.csv) is read into the program and displayed as a text in the text box as shown in the figure below. Each of the three columns is read into separated arrays and the string display shows each of the values in separate columns. The command button to activate displaying the point data is also enabled:

Fig 6: User reads in point data from file and program displays data as text on screen

User clicks on command button to display raster data: The user clicks on the command button and the colour coded raster data is displayed in the picture box as shown in the diagram below:

Fig 7: Raster data is displayed as colour coded raster in picture box

User clicks on command button to display point data: The user clicks on the command button and the point data with the different coloured points is displayed in the picture box as shown in the diagram below:

Fig 8: Point data is displayed in picture box

The diagram below shows the displays in the separate picture boxes for both the raster data and point data after they have been read from the files, stored in arrays and then retrieved for display.

Fig 9: Display of raster data and point data in different picture boxes

Displaying both raster data and point data in the same picture box: There is also another command button which when clicked, and data has been read from rasterinput.asc and temperature.csv, would display both data in the same picture box as shown in the diagram below where the point data is displayed on the raster data:

Fig 10: Display of raster data and point data in same picture box

User enters a wrong path: When the user enters a wrong path in the text box (i.e a file path that doesn’t exist), a message box is displayed informing the user to enter a valid file path. The user has to click and close the message box before control can be returned back to the form:

Fig 11: User enters wrong path and is prompted to make corrections in file path

User tries to display point data over raster data without reading raster data and a message box appears to inform him/her that both data need to be read in before displaying in the same picture box:

Fig 12: User attempts to display point data over raster data without reading files and is prompted

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.