Copypaste

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 24

Task 1 Form/interface design

Screenshots of the user interface

This is Form 1 user interface.

This is Form 2 user interface.

Task 2 Pseudocode and Object Definition Sheet

Pseudocode

Pseudocode for Select_Click from Form 1

When click the select

If is not selected “optBubblesort” and

If is not selected “Linearsearch” and

If is not selected “Binarysearch” and

If is not selected “Sertionsort” then

display the message "Please choose one algorithm."

If is not selected “Randomnumber” and


If is not selected “Externaltextfile” then

Display the message "Please choose one input method."

Pseudocode for Function ChooseFileButtonClicked() from Form 1

Declare dialog As OpenFileDialog

Declare selected As Boolean

Declare filename As String

Create dialog AS New OpenFileDialog

Show the file selection dialog

Get the selected filename

Check if file exists

Read entire file content

Overwrite text box content with filename (might need adjustment)

Display message the "No such file."

Make the "Next" button visible


Pseudocode for Next Form Visible from Form 1

Assuming frmSearchAndSortAlgorithm2 is another form

Hide the current form (referencing itself)

Hide the "Next" button

Hide the "gpbExternalTextFile" group box (assuming it's a group box)

Pseudocode for Form Load from Form 1

Hide the "Next" button

Hide the "gpbExternalTextFile" group box (assuming it's a group box)

Pseudocode for Back Button from Form 2

Assuming frmSearchAndSortAlgorithm1 is another form

Hide the current form (referencing itself)

Object Definition Sheet


Obj. Ref

Object Type

Property

Value

Event Procedure

Form

Name

frmSearchAndSortAlgorithm1

Form_Load()

Font

Microsoft Sans Serif, 9pt, style=Bold

BackColor

MenuHighlight

ForeColor

ControlText

Text

Search and Sort Algorithm Deomostration Form 1


2

Label

Name

lblSearchAndAlgorithm

None

Font

Microsoft Sans Serif, 8pt

BackColor

Transparent

ForeColor

Black

Text

Search And Sort Algorithm Deomostration

Label

Name

lblChooseAlgorithm
None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

GroupBox

Name

gpbAlgorithm

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

RadioButton

Name

optBubblesort
None

Text

a bubble sort

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

RadioButton

Name

optInsertionsort

None

Text

an insertion sort

None
Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

RadioButton

Name

optLinearsearch

None

Text

a linear search

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

RadioButton
Name

optBinarysearch

None

Text

a binary search

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

Label

Name

lblImportedDataSet

None

Font

Microsoft Sans Serif, 8pt


ForeColor

ControlText

10

GroupBox

Name

gpbImportedDataSet

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

11

RadioButton

Name

optRandomnumber

None

Text

Random number
None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

12

RadioButton

Name

optExternaltextfile

Nome

Text

External text file

None

Font

Microsoft Sans Serif, 8pt

ForeColor
ControlText

13

Button

Name

cmdSelect

CmdSelect_Click

Text

Select

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

14

GroupBox

Name

gpbExternalTextFile

None

Font
Microsoft Sans Serif, 8pt

ForeColor

ControlText

15

Label

Name

lblExternalTextFile

None

Font

Microsoft Sans Serif, 8pt

ForeColor

ControlText

16

TextBox

Name

txtData

None
Text

None

Font

Microsoft Sans Serif, 8pt

ForeColor

Green

17

Button

Name

cmdChoose

cmdChoose_Click

Text

Choose

None

Font

Microsoft Sans Serif, 8pt

18

Button
Name

cmdNext

cmdNext_Click

Text

Next

None

Font

Microsoft Sans Serif, 8pt

19

Form

Name

frmSearchAndSortAlgorithm2

Form_Load()

Font

Microsoft Sans Serif, 9pt, style=Bold

BackColor

MenuHighlight
ForeColor

ControlText

Text

Search and Sort Algorithm Deomostration Form 2

20

Label

Name

lblProcess

None

Font

Microsoft Sans Serif, 9pt, style=Bold

ForeColor

ControlText

Text

Process

21
TextBox

Name

txtSearchNumber

None

Text

None

Font

Microsoft Sans Serif, 8pt

ForeColor

Green

22

Label

Name

lblSearchNumber

None

Font

Microsoft Sans Serif, 8pt


ForeColor

ControlText

23

TextBox

Name

txtDisplay

None

Text

None

Font

Microsoft Sans Serif, 8pt

ForeColor

Green

24

Button

Name

cmdRun

cmdNext_Click
Text

Next

None

Font

Microsoft Sans Serif, 8pt

25

Button

Name

cmdClear

cmdClear

_Click

Text

Next

None

Font

Microsoft Sans Serif, 8pt

26

Button

Name
cmdExit

cmdExit

_Click

Text

Next

None

Font

Microsoft Sans Serif, 8pt

27

Button

Name

cmdBack

cmdBack

_Click

Text

Next

None

Font

Microsoft Sans Serif, 8pt

28
Button

Name

cmdStartAgain

cmdStartAgain

_Click

Text

Next

None

Font

Microsoft Sans Serif, 8pt

Task 3 Implementation – Main program

Form 1

Imports System.IO

Public Class frmSearchAndSortAlgorithm1

Private Sub cmdSelect_Click(sender As Object, e As EventArgs) Handles


cmdSelect.Click

If optBubblesort.Checked = False And optLinearsearch.Checked = False And


optBinarysearch.Checked = False And optInsertionsort.Checked = False Then

MsgBox("Please choose one algorithm.")

Return

End If
If optRandomnumber.Checked = False And optExternaltextfile.Checked = False
Then

MsgBox("Please choose one input method.")

Return

ElseIf optRandomnumber.Checked = True Then

cmdNext.Visible = True

gpbExternalTextFile.Visible = False

ElseIf optExternaltextfile.Checked = True Then

gpbExternalTextFile.Visible = True

cmdNext.Visible = False

End If

End Sub

Private Sub cmdChoose_Click(sender As Object, e As EventArgs) Handles


cmdChoose.Click

Dim myReader As StreamReader

Dim dialog As OpenFileDialog

Dim selected As Boolean

Dim filename As String

dialog = New OpenFileDialog

selected = dialog.ShowDialog

If selected = True Then

filename = dialog.FileName

If File.Exists(filename) Then

myReader = File.OpenText(filename)
txtData.Text = myReader.ReadToEnd

txtData.Text = filename

Else

MsgBox("No such file.")

End If

End If

cmdNext.Visible = True

End Sub

Private Sub cmdNext_Click(sender As Object, e As EventArgs) Handles


cmdNext.Click

frmSearchAndSortAlgorithm2.Show()

Me.Visible = False

End Sub

Private Sub frm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

cmdNext.Visible = False

gpbExternalTextFile.Visible = False

End Sub

End Class

Form 2

Imports System.Windows.Forms
Public Class frmSearchAndSortAlgorithm2

Private Sub cmdBack_Click(sender As Object, e As EventArgs) Handles


cmdBack.Click

frmSearchAndSortAlgorithm1.Show()

Me.Visible = False

End Sub

End Class

You might also like