mevets
Member
I have a a series of buttons that are handled by one subroutine. Once one of the buttons is pressed I want to create a new control on the form of whatever button was pressed. I've managed to put the type of control into a string:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
From here I want to know if and how I can
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
or should I just do a large If then else like
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I'm not sure what to do, can someone point me in the right direction?
	
		
			
		
		
	
				
			
			
				VB.NET:
			
		
		
		strCtrlType = sender.ToString()
			
				VB.NET:
			
		
		
		Dim newCtrl as new strCtrlType
			
				VB.NET:
			
		
		
		If strCtrlType = "Button" Then
Dim newCtrl as new Button
ElseIf strCtrlType = "Label"
Dim newCtrl as new Label
ElseIf....
etc 
	 
 
		 
 
		 
 
		 
 
		
 
 
		 
 
		 
 
		