473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple form creation problem - CF2005

This is driving me crazy! It should be so simple! Can anyone tell me
what is going wrong? All I am doing is adding a single button to a
form but it fails :-(

I am using VB.NET 2005 to create an application for Windows Mobile
2005. I have a form and in the Form_Load event I have the following
code:

Call BuildForm()
Me.Show()

Then, in the called sub I have the following:

Private Sub BuildForm()

Dim newButton As New Button

With newButton

.Name = "Switch"
.Anchor = AnchorStyles.Left
.Enabled = True
.Height = 50
.Left = 50
.Parent = Me
.Text = "Switch"
.Visible = True
.Width = 150

End With

Me.Controls.Add(newButton)

End Sub
Which gives me the following error on startup at the line "Dim
newButton As New Button":

System.NotSupportedException was unhandled
Message="NotSupportedException"
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Windows.Forms.Control._InitInstance()
at System.Windows.Forms.Control..ctor()
at System.Windows.Forms.ButtonBase..ctor()
at System.Windows.Forms.Button..ctor()
at NoData.MainScreen.BuildForm()
at NoData.MainScreen.MainScreen_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at NoData.MainScreen.Main()

TIA,
Hugh

Aug 21 '07 #1
0 1070

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
0
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and...
2
by: Marty | last post by:
Hi, I have this issue where a form that contain a System.windows.forms.mainmenu has its height increased by the height of the mainmenu at object creation level. Here's the idea: //form...
3
by: ctbfalcon | last post by:
So I have a progress bar that I would like to be diplayed as the program is working on adding a network printer. I want to do this because while the program is "thinking" the user is not sure if...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.