Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How to set default item to dropdownlist?

$
0
0

Hi Friends,

I am using below code to bind data to comboBox in windowsForm

string comboBoxListVal = "Accept  Rejected  None";
               ((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).Items = comboBoxListVal.Split('\t');

It binds data in comboBox as below one by one

Accept

Rejected

None

Up to here all is fine

My question how i can set a default Text to ComboBox from one of the Items

eg: when form load comboBox having default text with "Rejected"

I tried by using mSprd.Text="Rejected";  but no luck

mSprd.GetCurrentMetaCell().CellType = new Cerner.ApplicationFramework.Spread.CellTypes.ComboBoxEnterCellType();

   string comboBoxListVal = "Accept  Rejected  None";
               ((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).Items = comboBoxListVal.Split('\t');

//Set Height and Width

 Size sz = ((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).GetPreferredSize(((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).ListControl);
                ((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).ListWidth = sz.Width;
                ((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).Editable = false;
                ((FarPoint.Win.Spread.CellType.ComboBoxCellType)mSprd.GetCurrentMetaCell().CellType).ListAlignment = FarPoint.Win.ListAlignment.Right;                
             
             


Can anybody helps me ?

My complete code for binding



PS.Shakeer Hussain



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>