Axis Specific

ChartsAreas > Collection > ChartArea1 > Axes > Collection This is how you get to the properties for the axis of a basic chart. Labels – The Markers Along Each Axis Intervals shown with decimal places of incorrect value added. The interval setting is a double and if your source value is say a single […]

Read More

Arrays In A Class

Resizing An Array Of Objects In A Class It won’t work. Best approach usually is to use a list instead of an array. Alternatively you have to copy the array to a new array with a different size using Array::Copy Array::Copy(obj->ClassValueArray1, ClassValueArray1, NewSize);

Read More

.Using List

Unlike arrays, the List collection type resizes dynamically.  If you are working with data where you would need to be resizing an array a lot then use a list instead.  It is ideal for linear collections that you don't need to adjust using an index. Good resources http://www.dotnetperls.com/list You need this namespace using namespace System::Collections::Generic; […]

Read More

Copy A Class

Copying A Class If your class has no pointer and no dynamic memory allocation then you don’t need to provide a copy function – you can use ‘=’. However if this isn’t true (i.e. your class contains a string or other object), then you need to provide a copy function or otherwise if you try […]

Read More

Copy to clipboard

System::Windows::Forms::Clipboard Copy text to the clipboard Clipboard::SetText(SomeTextBox->Text); Copy Image To Clipboard MemoryStream ^MemoryStream1 = gcnew MemoryStream(); Chart1->SaveImage(MemoryStream1, DataVisualization::Charting::ChartImageFormat::Bmp); System::Drawing::Bitmap ^Bitmap1 = gcnew System::Drawing::Bitmap(MemoryStream1); System::Windows::Forms::Clipboard::SetImage(Bitmap1);

Read More

Working With Characters In Strings

Replace A Character In A String sTemp = “ABCDEF”; sTemp = sTemp->Substring(1, 1); //Get a single character from the source string Result = Result->Remove(LICENSER_PRODUCT_ID_1_INDEX, 1); //Remove the character to be replaced in the destination string Result = Result->Insert(LICENSER_PRODUCT_ID_1_INDEX, sTemp); //Add the character

Read More

Write File Thread Safe

This example is based on writing a file from asynchronously received TCP packets.  FileStream->Write is not thread safe, so this approach deals with letting file write occur in the background and waiting for it to complete before writing the next received block of data bytes. In your header file FileStream ^ClientRxFileStream1; IAsyncResult ^ClientRxFileStreamAsyncResult1; array<Byte> ^ClientReceiveFileWriteBytes; […]

Read More

Link two forms

Set the secondary form owner to the main form.  For instance, if you have created another form you do this: frmMyOtherForm->Owner = this;

Read More

Serialization Of A Class

Serialization is the process of storing the state of an object or member for storage or transfer and deserialization is the process of restoring it.  Serialization is dead easy in .Net, as long as the same assembly is performing both the serialisation and deserialisation. Formats Serialize as Binary – More compact and faster, works well […]

Read More