Transferring a value to or from an MFC static text at runtime

By default, you cannot pass on a value to or from an MFC static text at runtime for the reason that it’s control ID doesn’t appear in the member variable’s tab when you activate the ClassWizard which precludes you to allocate a member variable to it. As you may know, the only way to pass a value to a control at runtime in MSVC++ is to map an instance variable to it. The following steps demonstrate how to make your static text control ID be made available in the ClassWizard ID list:


1. Add a static text control to your dialog-box by clicking on the Static text (Aa icon) and dragging it onto your dialog-box;


2. Your static text should now appear on your dialog with a default caption “Static”.



3. Right-click your static text>properties.


4.In the general tab, you will see the default ID of your Static text as IDC_STATIC.

STATIC in laypersons term means “unchanging” or “fixed” that’s why you cannot change its value at runtime. To be able to change its value, you’ll need to rename its ID from IDC_STATIC to IDC_WHATEVERDESCRIPTIVENAME, for instance IDC_NameLabel.


After changing its value from IDC_STATIC to IDC_WHATEVERDESCRIPTIVENAME, your Static text control should now appear in the ClassWizard ID lists, all you need to do is allocate a member variable to it so that you will be able to transfer a value to or from it at runtime. Same principle applies to Picturebox control.

Fixing the "No value given for one or more parameters" in Visual Web Developer 2008

This error normally appears when you have selected enable deleting and enable editing GridView or FormView task options and you try to delete or update a record at run-time. This error can be fixed by converting the SQL statements in the InsertCommand and AccessCommand to Jet SQL statements. To be able to clearly understand the solution, let us start from the beginning:
1. Create a database file in Ms-Access and name it “dbNames”. Make a table inside it and name it “tblEmployee” using the following specification:

2. Don’t forget to click yes when you will be ask to create primary key, otherwise you will not be able to add an Edit or Delete buttons to your grid view control.
3. Add appropriate values to your table, for instance:

4. Click Start>All Programs>Visual Web Developer 2008.
5. Click File>New Website>ASP.net Website>Ok.
6. Click View>Solution Explorer>Right-click your website solution name, Select Add Existing Item. Locate you dbnames access database file>Add. The solution explorer should now look like this.

7. Click the design tab then add a GridView control to your form.
8. In the Choose data source listbox, select new data source>Select Access database>Click the browse button>Select dbnames>Ok>Next>Click the * checkbox from the columns category>Click the advance button>Click the Generate Insert, Update, and Delete statements checkbox including the Use Optimistic Concurrency checkbox>Ok.
9. Click Next. Click test query to view the result of the sql statement then click finish.
10. Click the GridView task button(>) then check enable paging, enable sorting, enable editing, enable deleting, and enable selection checkboxes.
11. Click the View in Browser button. If you are prompted to save changes to your website, just click the yes button.
12. If you try to click or update a record value now, you will be taken to the following to a screen containing the following message:

13. To solve this problem, click the Source tab to view the source code of your website. Look for the following lines:

14. Delete the OR logical operators including its respective conditions, your code should now look like this:


15. Click the View Browser button and try clicking the Deleting or Record value. This time you can delete or delete a record value without getting a ““No value given for one or more required parameters”