Microsoft Visual C++ help
Results 1 to 7 of 7

Thread: Microsoft Visual C++ help

  1. #1
    Banned
    Join Date
    Oct 2002
    Posts
    121

    Microsoft Visual C++ help

    Hi,

    Ive got an assignment to do in Visual C++, but i'm stuck, so if any1 could help me out, it would really help me loads.

    Assignment:-

    Using MS Access, generate a table with the following fields:

    Family name
    First name
    Registration 'number' (8 characters, text)
    Gender(‘M’ or ‘F’)
    Course (‘A’,’B’, or ‘C’).

    Fill the table with a dozen ‘plausible’ records.

    Using Visual C++, generate a database aware application which allows the user to browse through the records. The user should be able to use a dialog box to alter any of the fields on a record.

    The dialog box should provide the choice for the ‘Gender’ field by using radio buttons, and the choice for the ‘Course’ field by using a drop-down list box which contains the entries: ‘Applied Electronics’, ‘Broadcast Technology’ and ‘Applied Computer Technology’. (The corresponding database entries are ‘A’, ‘B’, and ‘C’ respectively.

    The registration number should be validated, i.e. checked that it only contains numeric characters.



    I have made the database and started the Visual C++ stuff, which includes linking the database to the program. Up to now the Visual C++ program shows a screen which has 5 fields (the 5 needed), and displays each record. You can go to the next, first, last and previous records by using the File and Edit buttons atthe top of the screen.

    I have added buttons next to each of these fields, but dont know how to make a dialogue box pop up when the button is clicked. and how can i change the records from this dialogue box and save them if the user clicks ok, but doesnt save them if thry press cancel????

    If any1 knows how to do any of this, please post in here cos its driving me mad !!!

    Thanks in advance !!

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Posts
    1,027
    Hum, it's been a while since I've done VC++, but for the message box, check out something like
    Code:
    if( MessageBox(NULL, "Message", "Title", MB_YESNO) == IDYES )
          // Yes stuff
    else
          // No stuff
    More details on the MessageBox function here:
    http://msdn.microsoft.com/library/en...asp?frame=true

    Ammo
    Credit travels up, blame travels down -- The Boss

  3. #3
    Banned
    Join Date
    Oct 2002
    Posts
    121
    Thanks ammo - i will check the link out now - can any1 else help with the other stuff,

    thanks


    It's not really the message box i need, i need a dialogue box to pop up when a button is pressed next to a field, and then inside this dialogue box, it would let me change the field of the record, then give me 2 options via buttons - OK & Cancel

    If OK is press, the field is stored i nthe record, if cancel is pressed, all chages are cancelled.

    Also need to include this :-

    "The dialog box should provide the choice for the ‘Gender’ field by using radio buttons, and the choice for the ‘Course’ field by using a drop-down list box which contains the entries: ‘Applied Electronics’, ‘Broadcast Technology’ and ‘Applied Computer Technology’. (The corresponding database entries are ‘A’, ‘B’, and ‘C’ respectively.

    The registration number should be validated, i.e. checked that it only contains numeric characters."

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    472
    Have you decided how to access your database? My opinion is that ADO is by far the easiest way to handle database access. Check out this link on ADO programming in Visual C++ at the MSDN website: http://msdn.microsoft.com/library/de...gramming_5.asp

    Should be straightforward, if you run into trouble search Google for a tutorial. There are lots of them!

    Good luck!
    ---
    proactive

  5. #5
    Banned
    Join Date
    Oct 2002
    Posts
    121
    i have linked the DB in the VC++ program easily, and the program reads each record easily, i just need to know the code for the dialogue box to pop up - i think its somehting like Domodal, but i cant find anything that helps !!!!!


  6. #6
    Banned
    Join Date
    Oct 2002
    Posts
    121
    HELP !!!!

    OK - ive discoverd how to make a dialog box pop up now, i have been lookin on the net all day to find out how i can :-

    Make the registration number appear in the pop up box, which the user can change, and either save or cancel, and the pop up box closes.

    Once the registration number has been changed, it will appear in the main window in the Registration Number field.

    THANKS !!

  7. #7
    Banned
    Join Date
    Oct 2002
    Posts
    121
    HELP !!!!

    OK - ive discoverd how to make a dialog box pop up now, i have been lookin on the net all day to find out how i can :-

    Make the registration number appear in the pop up box, which the user can change, and either save or cancel, and the pop up box closes.

    Once the registration number has been changed, it will appear in the main window in the Registration Number field.

    THANKS !!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •