473,387 Members | 1,779 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,387 software developers and data experts.

How to use a dynamic forms name in a class

Dears,

I had long time developing windows applications using VB.NET and one of thing that I was always use is:

Class (Test) and inside it there are some subs like the following:

VB.NET Code.
Expand|Select|Wrap|Line Numbers
  1. Friend Sub FLoadKeyLock(ByVal FRMNAME As Object)
  2.         FRMNAME.Button1.Enabled = True
  3.         FRMNAME.Button2.Enabled = True
  4.         FRMNAME.Button3.Enabled = False
  5.         FRMNAME.Button4.Enabled = False
  6.         FRMNAME.Button5.Enabled = True
  7.         FRMNAME.Button6.Enabled = True
  8.         FRMNAME.Button7.Enabled = True
  9. End Sub
  10.  
Where FRMNAME refers to forms name the I send from different forms and I use (me) keyword to send it.

that was totally works fine in VB.NET but I cannot use it the same way in C#.NET.

C#.NET Code
Expand|Select|Wrap|Line Numbers
  1. internal void FLoadKeyLock (Form FRMNAME)
  2.         {
  3.             FRMNAME.Button3.Enabled = true;
  4.             FRMNAME.Button4.Enabled = true;
  5.             FRMNAME.Button1.Enabled = false;
  6.             FRMNAME.Button2.Enabled = false;
  7.             FRMNAME.Button5.Enabled = false;
  8.             FRMNAME.Button6.Enabled = false;
  9.             FRMNAME.Button7.Enabled = false;
  10.             FRMNAME.Button8.Enabled = false;
  11.             FRMNAME.Button9.Enabled = false;
  12.             FRMNAME.Button10.Enabled = false;
  13.         }
  14.  
The Error is: System.Windows.Forms.Form' does not contain a definition for 'Button3' and no extension method 'Button3' accepting a first argument of type

And same error for all used buttons.
So I have two questions:
1 - How to use such a function in C#.NET?
2 - Why it's not working the same way as VB.NET?


Thanks.
Nov 11 '15 #1
0 1093

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: diroddi | last post by:
How do you validate a SELECT field with m. lemos forms validation class. I want to make sure the user has selected a product and not left the field as the default of 'Select One'. ...
0
by: Rick Smit | last post by:
Hi, Are there any solutions available for creating dynamic forms? In our application customers need to customize some of the forms. Simply add, chance or delete one or more fields. I know some...
1
by: Alvaro MR | last post by:
Hi to everyone. I need some help about some questions. I want to create dynamic forms using .NET (Windows Forms, no ASP.NET) in the following way. Imagine I have an application with a 3...
1
by: amfi1 | last post by:
Hi My problem is as follows: I need to transmit data between two databases on the same server, but I have to use dynamic database names (they must be configurable). For example I need to...
5
by: Angelos | last post by:
Hello, I need to dynamically specify the name of a variable. I just read that $varA = "Cat"; echo $$varA; OUTPUT: Cat What I try to establish is somehow add a bit of text on my dynamic...
3
by: ryanmhuc | last post by:
Is it possible to have a dynamic table name within a query or a table name that is a variable? This does not work but gives an example: SELECT * FROM concat('table', 'name') - OR - SET @table...
3
by: Mark S. | last post by:
As I understand it, C# doesn't offer dynamic variable names. Below is my attempted workaround. Is what I'm doing possible? FYI, I already read all the "why in the world do you need dynamic...
5
by: Phil Latio | last post by:
Has anyone got any good advice on how to create dynamic forms? I am creating a subscription form where the subscriber selects which level of service they will have and depending on the selection...
7
by: cnsabar | last post by:
Hi , I need to create a dynamic variable name in array using Perl... For example.. if i give the input no as 5.. The program has to create a variable name as @array1 @array2 @array3...
1
by: smanif1 | last post by:
Report_Name_Final = "TABLENAME" DIM mySQL1 mySQL1 = "SELECT * FROM " mySQL1 = replace(mySQL1,"",Request.Form("Report_Name_Final")) response.write objRS1("Value") trying to get dynamic...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.