function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vidhyasagaran MuralidharanVidhyasagaran Muralidharan 

Problem in sobject describe

Public Class vfcontrol{
public List<selectoption> selectedObject {get; set;}
public vfcontrol()
selectedObject = new List<selectoption>();
Public void Objectnames()
for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
String name = objTyp.getDescribe().getName(); 
selectedObject.add(new SelectOption(name));
Error:Compile Error: Constructor not defined: [System.SelectOption].<Constructor>(String
Best Answer chosen by Vidhyasagaran Muralidharan
select option constructor takes two parameters as input. 1. Option Label 2. Option Name. So change to the below. It should work. Mark as best answer if it works for you. It helps others.

selectedObject.add(new SelectOption(name,name));