Welcome to the CSIG, a Special Interest Group of the ACGNJ. This is an exciting time for the C Language programming since Microsoft now has 4 different language compilers: C++, C++ Express, C-Sharp, and C-Sharp Express. These are all capable of creating Windows (tm) programs. (Some are FREE!)
Here's a brief synopsis of the coming meeting:
Visual Studio C++ includes many Database functions.
The program from last month has been advanced to include
DataSet and DataGridView
features. This application provides a very simple introduction to a major topic.
Other code changes include tooltips, mouse handlers, launching photo editors and
other programs, and searching a directory for JPG photo files. These things are
accomplished using .NET libraries.
The application is a graphic program that displays a photograph and a small text based
data file containing photo titles.
The program developed because I was creating a slide show with 846 photos.
A simple text file called "Subject.txt" contained the titles of each photo.
(You can see the text has now been imported into a self contained database table.)
I used notepad to edit the text file but quickly became exhausted when I
constantly had to correlate the photo filename with the title. Hence, the
new application called Tphoto. We will discuss the code for this program
at the meeting. It uses Microsoft Visual C++ 2008.
For further reading:
Dataset programming is a complex but rewarding area of computer programming.
Experience with other languages such as MS Access can help. You can link to external
databases on your computer or network using MySql or MS SQL.
Check out the following article for a simple XML example:
www.codeproject.com/KB/cpp/dataset.aspx
Other Sources of information include local help files within Visual Studio as
well as hundreds of pages of information on the Microsoft websites.
There are a number of ways to refer to Microsoft's latest compilers and code. Here's what Wikipedia says: The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft .NET Framework. The specification defines an environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures.
Microsoft .Net Framework 3.5 |
C++ 9.0 |
.Net 3.5 |
CLI |
Common Language Infrastructure |
Managed |
// Show the image on the screen. // private: System::Void Photos_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { e; sender; if (Photos->SelectedIndex < 0) return; // avoid crash! String ^lineBuff = gcnew String(Photos->SelectedItem->ToString()); String ^ imagefile = gcnew String(""); CurrentString = lineBuff; // Global Memorize new data, filename + tltle array<wchar_t> ^delims = {'\t'}; array<String^>^ token = lineBuff->Split(delims); CurrentIndex = Photos->SelectedIndex; // Global Memorize new index. if (token->Length == 0) { pictureBox1->Image = nullptr; title1->Clear(); return; } if (token->Length > 1) title1->Text = token[1]; // Initialize Text Box else title1->Clear(); imagefile = CurrentPath + token[0]; try { pictureBox1->Image = Image::FromFile(imagefile); } catch(...) { pictureBox1->Image = nullptr; } } // // OK button pressed. Copy the new title into the listbox. private: System::Void button_ok_Click(System::Object^ sender, System::EventArgs^ e) { e; sender; String ^lineBuff = gcnew String(CurrentString); array<wchar_t> ^delims = {'\t'}; array<String^>^ token = lineBuff->Split(delims); CurrentString = token[0]; CurrentString += "\t"; CurrentString += title1->Text->ToString(); Photos->Items->Add(CurrentString); Photos->Items->Remove(lineBuff); Photos->SelectedIndex = CurrentIndex; Photos->Invalidate(); Photos->Update(); dbDirty = true; } // // The SAVE button was pressed. Save the file to the hard drive. private: System::Void Save_Click(System::Object^ sender, System::EventArgs^ e) { e; sender; Save->BackColor = Color::Blue; Save->Update(); PutPhotoData(SubjectFile->Text); System::Threading::Thread::Sleep(1000); Save->BackColor = Save->DefaultBackColor; Save->Update(); } String ^CurrentString; String ^CurrentPath; int CurrentIndex; bool dbDirty;