Help needed
Help needed
Help needed
Help needed
Help needed
Help needed Help needed Help needed Help needed Help needed Help needed Help needed Help needed
Help needed Help needed
Help needed
Go Back  Xtreme Visual Basic Talk > > > Help needed


Reply
 
Thread Tools Display Modes
  #1  
Old 04-17-2012, 09:59 AM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default Help needed


When the program starts, it must load a series of parallel arrays with the following data in the following order:

Store Number State Manager
1017 CA-North Homer Gomez
1007 AZ Jake Johansen
1005 TX-Dallas Paula Hendricks
1010 AZ-Phoenix Henry Abernathy
a. Multi-dimension arrays are not allowed in this project.
b. The program must be designed to handle an unlimited number of stores.
1. Hint: Use a dynamic array.
c. After the data has been stored in the array, the array must be sorted into order by store number.
1. Hint: Create a procedure that sorts the array.

16. Browse Mode is:
a. Previous, Next, Add, Edit, and Delete buttons enabled.
b. Update and Cancel buttons disabled.
c. Number, State, and Manager text boxes set to read only equals true.
d. Accept button set to Next button.
e. The focus set to the Next button.
f. Hint: Create a procedure to handle this.

17. Add/Edit Mode is:
a. Previous, Next, Add, Edit, and Delete buttons disabled.
b. Update, and Cancel buttons enabled.
c. Number, State, and Manager text boxes set to read only equals false.
d. Accept button set to the Cancel button.
e. The focus set to the Number text box.
f. Hint: Create a procedure to handle this.

18. After the array is populated, the Store Information form must be displayed as shown.
a. The data for the lowest store number in the array must be displayed.
b. The tab index order must be set as indicated by the sample executable.
c. Access keys must be set and function as indicated by the sample executable.
d. If focus is set to a text box by program code or by the tab key, the contents of the text box must be
highlighted.
e. Input to the text boxes must be limited as follows:
1. Number - 4 characters
2. State - 20 characters
3. Manager - 30 characters
4. Hint: Use maximum length property of text box.

19. At all times, the data in the array must be displayed in order by store number.
a. Hint: Call the sort procedure.
b. Hint: Create a class level variable which always contains the index number of the currently displayed store.
Create a procedure to display the data in the text boxes. Have the display procedure use this current index to
determine which store to display. To display a specific store, set the current index to the store's index
number and then call the display procedure.

20. When the Previous button is clicked:
a. The form must display the record previous to the record currently being displayed on the form.
b. The focus must be set to the Next button.

21. When the Next button is clicked:
a. The form must display the record following the record currently being displayed on the form.
b. The focus must be set to the Next button.

22. If the user clicks the Add button:
a. The form must be set to Add/Edit Mode.
b. All text boxes must be cleared.
c. Focus must be set to the Number text box.
d. Hint: Create a class level variable which indicates that an add is in progress.

23. If the user clicks the Edit button:
a. The form must be set to Add/Edit Mode.
b. The record displayed when the Edit button was clicked must still be displayed.
c. Focus must be set to the Number text box.

24. If the user clicks the Update button the data input must be validated.
a. If any of the following rules are violated, an appropriate message box must be displayed.
b. Number
1. between 1000 and 9999 inclusive
2. If a store is being added, the store number must not already exist in the store array.
3. If the store number is being changed with an edit, the new store number must not already exist in the store
array.
4. Hint: Use an array index of to search for the store.
c. State
1. 1 - 20 characters long
d. Manager
1. 1 - 30 characters long
e. After the user responds to the error message, the focus must be set to the field in error.
1. Hint: Use Exit Sub.
f. If all data fields are valid and an add process is being completed, a new index must be created in the array and the data must be trimmed and written to that index.
1. Hint: Use a ReDim Preserve.
g. If all data fields are valid and an edit process is being completed, the updated data must be trimmed and
written to the current index in the array.
h. The array must be sorted.
i. The form must return to Browse Mode.
j. The data for the updated store must be displayed.
1. Hint: Before modifying the array, save the store number. After the update process is complete, use an
array index of command to search for the index of the saved store number and display that store.
k. The focus must be set to the Next button.

25. If user clicks the Cancel button:
a. If the array is not empty:
1. The unaltered data for the record being displayed prior to the add or update action must be re-displayed.
2. The form must return to Browse Mode.
3. Focus must be set to the Next button.
b. If the array is empty:
1. The form must remain in Add/Edit Mode.
2. Hint: Check the length of the array.

26. If the user clicks the Delete button:
a. The user must be asked to confirm the delete request.
1. Focus must be set to the No button.
b. If the user responds Yes to the delete confirmation:
1. The record must be deleted from the array.
a. Hint: Change the store number in the array to XXXX. Sort the array. ReDim Preserve the array
decreasing the size of the array by one.
c. If the user responds No to the delete confirmation:
1. The record displayed when the Delete button was clicked must still be displayed.
2. Focus must be set to the Next button
d. If, after the record is deleted, the array contains data:
1. The form must be set to Browse Mode
2. The first record in the array must be displayed.
3. Focus must be set to the Next button.
e. If, after the record is deleted, the array is empty:
1. The form must be set to Add/Edit Mode.
2. Focus must be set to the Name text box.

and this is i have done so far
Code:
Option Strict On
Public Class StoreInformationForm
  Private Sub StoreInformationForm_Load(sender As System.Object, _
    e As System.EventArgs) Handles MyBase.Load
    numberTextBox.Text = "1005"
    stateTextBox.Text = "TX-Dallas"
    managerTextBox.Text = "Paula Hendricks"
    updateButton.Enabled = False
    cancelProcessButton.Enabled = False
  End Sub 'StoreInformationForm_Load
  Private Sub addButton_Click(sender As System.Object, _
    e As System.EventArgs) Handles addButton.Click
    Dim number As Double
    Dim state As Char
    Dim manager As Char
    Double.TryParse(numberTextBox.Text, number)
    If number < 1000 Then
      Call DisplayMessage("Store number must be between 1000 and 9999 inclusive.")
      Exit Sub
    End If 'number < 1000
    Char.TryParse(stateTextBox.Text, state)
    If state < "1" Then
      Call DisplayMessage("State description must be 1-20 characters in lenght.")
      Exit Sub
    End If 'state < "1"
    Char.TryParse(managerTextBox.Text, manager)
    If manager < "1" Then
      Call DisplayMessage("Manager's name must be 1-30 characters in lenght.")
      Exit Sub
    End If ' manager < "1"
    previousButton.Enabled = False
    nextButton.Enabled = False
    addButton.Enabled = False
    editButton.Enabled = False
    deleteButton.Enabled = False
    updateButton.Enabled = True
    cancelProcessButton.Enabled = True
    stateTextBox.Clear()
    managerTextBox.Clear()
    numberTextBox.Clear()
    numberTextBox.Focus()
  End Sub 'addButton_Click
  Private Sub cancelProcessButton_Click(sender As System.Object, _
    e As System.EventArgs) Handles cancelProcessButton.Click
    previousButton.Enabled = True
    nextButton.Enabled = True
    addButton.Enabled = True
    editButton.Enabled = True
    deleteButton.Enabled = True
    updateButton.Enabled = False
    cancelProcessButton.Enabled = False
    numberTextBox.Text = "1005"
    stateTextBox.Text = "TX-Dallas"
    managerTextBox.Text = "Paula Hendricks"
  End Sub 'cancelProcessButton_Click
  Private Sub deleteButton_Click(sender As System.Object, _
    e As System.EventArgs) Handles deleteButton.Click
    If MessageBox.Show("Delete the current record?", "Store Information - Delete a store", _
     MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, _
     MessageBoxDefaultButton.Button1) = DialogResult.Yes Then
      numberTextBox.Text = String.Empty
      stateTextBox.Text = String.Empty
      managerTextBox.Text = String.Empty
    End If 'MessageBox.Show
  End Sub 'deleteButton_Click
  Private Sub editButton_Click(sender As System.Object, _
    e As System.EventArgs) Handles editButton.Click
    previousButton.Enabled = False
    nextButton.Enabled = False
    addButton.Enabled = False
    editButton.Enabled = False
    deleteButton.Enabled = False
    updateButton.Enabled = True
    cancelProcessButton.Enabled = True
    cancelProcessButton.Focus()
  End Sub 'editButton_Click
  Private Sub updateButton_Click(sender As System.Object, _
    e As System.EventArgs) Handles updateButton.Click
    previousButton.Enabled = True
    nextButton.Enabled = True
    addButton.Enabled = True
    editButton.Enabled = True
    deleteButton.Enabled = True
    updateButton.Enabled = False
    cancelProcessButton.Enabled = False
    numberTextBox.Text = "1005"
    stateTextBox.Text = "TX-Dallas"
    managerTextBox.Text = "Paula Hendricks"
  End Sub 'updateButton_Click
  Private Sub DisplayMessage(ByVal prompt As String)
    'Display message
    MessageBox.Show(prompt, "Store Information - Add or Delete a Store", _
      MessageBoxButtons.OK, MessageBoxIcon.Exclamation, _
      MessageBoxDefaultButton.Button1)
  End Sub 'DisplayMessage
End Class 'StoreInformationForm

Last edited by Cerian Knight; 04-17-2012 at 10:13 AM. Reason: Added [code]...[/code] tags
Reply With Quote
  #2  
Old 04-17-2012, 10:35 AM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

So what exactly are you having problems with?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 04-17-2012, 10:53 AM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

when the edit/add button is click the text boxes must be enabled to enter data and after the data is entered and saved the text boxes should be disabled
when the previous/next button is click it should show the records that in the form and also the data we entered
when the update button is click it should save the data when we edit or add
Reply With Quote
  #4  
Old 04-17-2012, 11:08 AM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

So does your code fail in some way? Is it throwing errors?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #5  
Old 04-17-2012, 11:20 AM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

yes ive tried textbox.enabled = true/false , does not add data and when delete is click it should remove the data in the textbox and it must not show again while the program is running.
next and previous button not working
Reply With Quote
  #6  
Old 04-17-2012, 11:31 AM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

I can see certain things that are probably causing problems

e.g.
Code:
Char.TryParse(stateTextBox.Text, state)
    If state < "1" Then
      Call DisplayMessage("State description must be 1-20 characters in lenght.")
      Exit Sub
    End If 'state < "1"
I'm not sure that code is doing what you think it is - if you step through it in a debugger does it behave as expected? Also the point of using things like Char.TryParse is you can check the return value to see if it works.

More fundamentally though is the code you posted doesn't seem to actually create an array to store all this information, without this array then adding, deleting and moving through an array is going to be problematic.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #7  
Old 04-17-2012, 01:12 PM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

you mean i dont have an array to store all information, without this array then adding, deleting and moving through. can you help how to create an array
Reply With Quote
  #8  
Old 04-17-2012, 02:28 PM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

http://msdn.microsoft.com/en-us/library/wak0wfyt.aspx is probably as good a starting point as any if you have no experience with arrays.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #9  
Old 04-17-2012, 02:45 PM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

can you give an example
Reply With Quote
  #10  
Old 04-17-2012, 03:05 PM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Aren't there enough examples in the link I posted?

Is there a particular problem you are having with arrays?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #11  
Old 04-17-2012, 03:16 PM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

yes i dont know how to create an array, this is my first semester taking programming
Reply With Quote
  #12  
Old 04-17-2012, 03:18 PM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

how does the previous and next button work
Reply With Quote
  #13  
Old 04-17-2012, 03:20 PM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

The link gives you examples of creating and sizing arrays. To go forwards and backwards you would need to track the current position and use that as an index into the array.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #14  
Old 04-18-2012, 08:22 AM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

can you do next button code as example and then i know what it looks like then i can do the rest
Reply With Quote
  #15  
Old 04-18-2012, 09:27 AM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

So what code do you currently have? I am assuming you have now got more code than in the original post, at the very least I would imagine you have created an array. Show what you now have and I can give advice on what needs to be done next.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #16  
Old 04-18-2012, 09:32 AM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default need help

dim numbers as integer
integer.trypharse(numberstextbox.text, numbers)
number.Position < (numbers.Count - 1) Then
numbers.Position += 1
Else
numbers.Position -= 1
End If
i have only for numberstextbox

Last edited by Pravish; 04-18-2012 at 09:33 AM. Reason: missed some details
Reply With Quote
  #17  
Old 04-18-2012, 02:33 PM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

dim numbers as integer
integer.trypharse(numberstextbox.text, numbers)
number.Position < (numbers.Count - 1) Then
numbers.Position += 1
Else
numbers.Position -= 1
End If
i have only for numberstextbox
Reply With Quote
  #18  
Old 04-18-2012, 03:04 PM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

So where exactly is the variable numbers declared and what does it's declaration look like?

Have you tried compiling this code to see if it works?

The posted code seems to be missing the start of an If statement but I'm not entirely sure what it should be doing anyway.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #19  
Old 04-18-2012, 03:10 PM
Pravish Pravish is offline
Regular
 
Join Date: Mar 2012
Posts: 50
Default

the form runs but stops with error and you said im missing an if statement so where that goes or how the goes
Reply With Quote
  #20  
Old 04-18-2012, 03:16 PM
PlausiblyDamp's Avatar
PlausiblyDampHelp needed PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

The code you posted has an Else statement and an End If statement, there should be an If statement before them.

The If statement is used when you have a decision to make, without knowing what the code you posted is supposed to do I have no idea what the If statement would be.

Is this actually cut and pasted from your application or have you retyped it? When the application
Quote:
stop with error
what error does it actually give?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply

Tags
c++, vb code


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Help needed
Help needed
Help needed Help needed
Help needed
Help needed
Help needed Help needed Help needed Help needed Help needed Help needed Help needed
Help needed
Help needed
 
Help needed
Help needed
 
-->