Click here to Skip to main content
15,914,780 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello. I'm trying to write a simple program but keep getting this error : error C2447: missing function header (old-style formal list?). can anyone explain why??

{
public partial class Form1 : Form

public Form1 ()


Private Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub

Private Sub STPbtn_Click(sender As Object, e As EventArgs) Handles STPbtn.Click
Timer1.Stop()
End Sub

Private Sub SSChk_Tick(sender As Object, e As EventArgs) Handles SSChk.Tick
If (GetAsyncKeyState(117)) Then
Timer1.Start()
End If
If (GetAsyncKeyState(118)) Then
Timer1.Stop()
End If
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim BMP As New Drawing.Bitmap(1, 1)
Dim GFX As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(BMP)
GFX.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y),
New Drawing.Point(0, 0), BMP.Size)
Dim Pixel As Drawing.Color = BMP.GetPixel(0, 0)
CPpanel.BackColor = Pixel
Redtxt.Text = Pixel.R
Greentxt.Text = Pixel.G
Bluetxt.Text = Pixel.B
TextBox1.Text = Pixel.ToString


End Sub

Private Sub CPpanel_Paint(sender As Object, e As PaintEventArgs) Handles CPpanel.Paint

End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.Text = OpenFileDialog1.FileName
PictureBox1.ImageLocation = TextBox1.Text
End If
End Sub


Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs)

End Sub


Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Process.Start("http://www.google.com/search?client=mysearch&q=" & TextBox1.Text)
End Sub

Private Sub CPpanel_Paint(sender As Object, Optional p2 As Object = Nothing, Optional e As EventArgs = Nothing)
Throw New NotImplementedException
End Sub


Private Sub STbnt_Click(sender As Object, e As EventArgs) Handles STbnt.Click

End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click

End Sub


Private Sub Bluetxt_TextChanged(sender As Object, e As EventArgs) Handles Bluetxt.TextChanged

End Sub

Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click

End Sub


End Class};
}

What I have tried:

I've checked all braces to ensure that they are all correct.
Posted
Updated 14-Jan-20 20:04pm
Comments
ZurdoDev 14-Jan-20 16:59pm    
This is not C++, it is VB. And you also have {} around the code which is not VB so you seem to have quite a mess.

Simple: that's not C++ code, it's VB code with curly brackets thrown in to some bad C# code.

Go back to where you got that and start again: it's not valid in any language!
 
Share this answer
 
Maybe try using the correct compiler. That's not C++. Is it VB? In any case, please post formatted code, and make sure you've got the whole thing. This seems to start with a stray { (but VB isn't in my tool box, so maybe that's OK?), but:
VB
End Class}; // Matches with opening brace
} // dangling brace
 
Share this answer
 
You question and code showing that you got no clue about coding. You arent event clear about the used language copying some code snippets from different language. Looks like a mix of VB and C# pasted into a C++ project.

So first get clear about it and than read or view some tutorials in the internet to acquire some knowledge to use it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900