I'm having a small problem with my button. I have the main done, but I am not able to figure out how to convert this code from VB. The ClickCount is the problem, and I'm not sure how to fix. The VB version is Dim ClickCount As Integer = 1, but how do I fix it to work in C++
#pragma once
namespace New {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ ButtonClick;
private: System::Windows::Forms::TextBox^ textBoxMessage;
protected:
if Not ClickCount = 3 Then
ClickCount += 1
Else
ClickCount = 1
End If
Select Case ClickCount
Case Is = 1
TextMessage.BackColor = Color.Green
TextMessage.ForeColor = Color.White
Case Is = 2
TextMessage.BackColor = Color.Red
TextMessage.ForeColor = Color.Black
Case Is = 3
TextMessage.BackColor = Color.Orange
TextMessage.ForeColor = Color.Green
End Select
If Not ClickCount = 3 Then
ClickCount += 1
Else
ClickCount = 1
End If
Select Case ClickCount
Case Is = 1
Me.BackColor = Color.Red
Case Is = 2
Me.BackColor = Color.Blue
Case Is = 3
Me.BackColor = Color.Purple
End Select
}
};
}