Dictionary Builder Part 1 Getting Started.

Slides:



Advertisements
Similar presentations
Practical Programming COMP153-08S Lecture: Repetition Continued.
Advertisements

VBA Modules, Functions, Variables, and Constants
Reading and Writing Files Keeping Data. Why do we use files? ä For permanently storing data. ä For dealing with information too large to fit in memory.
Developing Software Applications Introduction to Programming Fundamentals Scoping in VB Simple Ifs in VB.
Visual Programming w/ Visual Basic How to prepare your mind to face the endless nightmare By Williem.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
110-G1 Motivation: Within a program, may have to perform the same computation over and over Many programs share the same computation (e.g. sorting) To.
Do Loop with Interest Please see speaker notes for additional information!
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 1B) UTPA – Fall 2011.
© 1999, by Que Education and Training, Appendix A, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
1 Flow Control II Code: Select-Case and For-Next Controls: Frames and OptionButtons.
Class 3 Remote Instruction Computer Math EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Validation "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to.
Two Forms Please use speaker notes for additional information!
Copyright © 2001 by Wiley. All rights reserved. Chapter 6: Using Arrays Control Arrays List Arrays Finding Items in Arrays Multiple Forms 2-Dimensional.
4-1 Chapter 4 The Selection Process in VB.NET. 4-2 Learning Objectives Understand the importance of the selection process in programming. Describe the.
Lab 4 - Variables. Information Hiding General Principle: – Restrict the access to variables and methods as much as possible Can label instance variables.
Pay Example (PFirst98) Please use speaker notes for additional information!
MIS 3200 – Unit 5.1 Iteration (looping) – while loops – for loops Working with List Items.
31/01/ Selection If selection construct.
05/02/ Records. 205/02/2016 Learning Objectives State: The difference between records and arrays. The difference between records and arrays. How.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 11 So Many Paths … So Little Time.
5a – While Loops Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
Using Forms and Form Elements In Visual Basic.NET.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Chapter 6 Controlling Program Flow with Looping Structures.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Use TryParse to Validate User Input
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
Use TryParse to Validate User Input
Introducing Do While & Do Until Loops & Repetition Statements
الاسباب الأضرار وسائل الحمايه
Introduction to Python
البرمجة بلغة فيجول بيسيك
مراحل كتابة البرنامج بلغة فيجول بيسك ستديو
Visual Basic..
مراجعة الحاسب.
Introduction to Python
Department Array in Visual Basic
Conditions and Ifs BIS1523 – Lecture 8.
حلقات التكرار.
البرمجة بلغة فيجول بيسك ستوديو
المحاضرة الأولى Lab(1) أ.ساره الأحمدي برمجة حاسب 2.
Do … Loop Until (condition is true)
Part 3 Saving (without the Save button)
If, Subroutines and Functions
JavaScript.
Dictionary Builder Part 4 Loading Files.
Active-X Calendar Control
Part 2 Saving the Dictionary
C# Revision Cards Data types
MIS 3200 – Unit 5.1 Iteration (looping) Working with List Items
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Boolean in C++ CSCE 121.
Presentation transcript:

Dictionary Builder Part 1 Getting Started

Step 1 – build the Form Controls: grpInput btnOpenDictionary lstWords btnExtractWords txtNewWord btnAddWord btnOpenDictionary lstWords btnSave btnExit + and assorted labels

Which control will provide the easiest place to start? Step 2 – start easy Which control will provide the easiest place to start?

Which control will provide the easiest place to start? btnAddWord. Step 2 – start easy Which control will provide the easiest place to start? btnAddWord.

Step 2 – btnAddWord What does it do?

Step 2 – btnAddWord What does it do? It moves a word from the textBox to the listBox.

Step 2 – btnAddWord What does it do? How? It moves a word from the textBox to the listBox. How?

Step 2 – btnAddWord What does it do? How? It moves a word from the textBox to the listBox. How? if there's something in the textBox

Step 2 – btnAddWord What does it do? How? It moves a word from the textBox to the listBox. How? if there's something in the textBox copy it to the listBox

Step 2 – btnAddWord What does it do? How? What else should be done? It moves a word from the textBox to the listBox. How? if there's something in the textBox copy it to the listBox What else should be done?

Step 2 – btnAddWord What does it do? How? It moves a word from the textBox to the listBox. How? if there's something in the textBox copy it to the listBox set the focus back in the textBox

Step 2 – btnAddWord What does it do? How? It moves a word from the textBox to the listBox. How? if there's something in the textBox copy it to the listBox set the focus back in the textBox clear the textBox

BUT not everything should go into the listBox

BUT not everything should go into the listBox What conditions should be imposed on the text strings entered by the User?

BUT not everything should go into the listBox We need to deal with “words” that: have UPPER case characters

BUT not everything should go into the listBox We need to deal with “words” that: have UPPER case characters are too long

BUT not everything should go into the listBox We need to deal with “words” that: have UPPER case characters are too long have non-alpha characters

BUT not everything should go into the listBox We need to deal with “words” that: have UPPER case characters are too long have non-alpha characters duplicate a word in the list

BUT not everything should go into the listBox We need to deal with “words” that: have UPPER case characters are too long have non-alpha characters duplicate a word in the list These tasks will be facilitated by using an identifier instead of object.property notation, and sub-programs.

Step 2 – btnAddWord Revisiting our pseudo code… if there's something in the textBox copy it to the listBox set the focus back in the textBox clear the textBox

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then End If

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then Dim newWord = LCase(txtWord.Text) lstWords.Items.Add(newWord) End If

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then Dim newWord = LCase(txtWord.Text) lstWords.Items.Add(newWord) txtWord.Focus() End If

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then Dim newWord = LCase(txtWord.Text) lstWords.Items.Add(newWord) txtWord.Focus() txtWord.Clear() End If

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then Dim newWord = LCase(txtWord.Text) If Len(newWord) <= 11 Then lstWords.Items.Add(newWord) txtWord.Focus() txtWord.Clear() End If

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then Dim newWord = LCase(txtWord.Text) If Len(newWord) <= 11 Then lstWords.Items.Add(newWord) txtWord.Focus() txtWord.Clear() Else txtWord.SelectAll() End If

Step 2 – btnAddWord If txtWord.Text <> vbNullString Then Dim newWord = LCase(txtWord.Text) If Len(newWord) <= 11 And isWord(newWord) Then lstWords.Items.Add(newWord) txtWord.Focus() txtWord.Clear() Else txtWord.SelectAll() End If

Step 2.1 – isWord() Private Function isWord() End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String) As Boolean End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String) As Boolean Return ??? End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String) As Boolean Return flag End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String As Boolean Dim flag = True Return flag End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String) As Boolean Dim flag = True Dim c As Integer For c = 1 To Len(t) ˈ under some condition flag = False Next Return flag End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String) As Boolean Dim flag = True Dim c As Integer For c = 1 To Len(t) Dim thisC = Mid(t, c, 1) If thisC < "a" Or thisC > "z" Then flag = False End If Next Return flag End Function

Step 2.1 – isWord() Private Function isWord(ByVal t As String) As Boolean Dim flag = True Dim c As Integer For c = 1 To Len(t) Dim thisC = Mid(t, c, 1) If thisC < "a" Or thisC > "z" Then flag = False Exit For End If Next Return flag End Function

Step 2.2 - isUnique() End Function Private Function isUnique(ByVal t As String) As Boolean End Function

Step 2.2 - isUnique() Dim flag = True Return flag End Function Private Function isUnique(ByVal t As String) As Boolean Dim flag = True Return flag End Function

Step 2.2 - isUnique() Dim flag = True Dim i As Integer Private Function isUnique(ByVal t As String) As Boolean Dim flag = True Dim i As Integer For i = 0 To lstWords.Items.Count - 1 ˈ under some condition flag = False Next Return flag End Function

Step 2.2 - isUnique() Dim flag = True Dim i As Integer Private Function isUnique(ByVal t As String) As Boolean Dim flag = True Dim i As Integer For i = 0 To lstWords.Items.Count - 1 If t = lstWords.Items.Item(i) Then flag = False Exit For End If Next Return flag End Function