Click here to Skip to main content
15,917,610 members
Home / Discussions / C#
   

C#

 
QuestionHow to write "Failed to load a doc " if a server is down Pin
JoanMike28-Mar-06 11:07
JoanMike28-Mar-06 11:07 
QuestionCrop an image without creating bitmap Pin
Libor Tinka28-Mar-06 10:50
Libor Tinka28-Mar-06 10:50 
AnswerRe: Crop an image without creating bitmap Pin
Christian Graus28-Mar-06 15:42
protectorChristian Graus28-Mar-06 15:42 
Questionconvert xml file Pin
ap_sa28-Mar-06 10:41
ap_sa28-Mar-06 10:41 
QuestionDirectX and tabpages Pin
melanieab28-Mar-06 8:59
melanieab28-Mar-06 8:59 
AnswerRe: DirectX and tabpages Pin
BlackDice28-Mar-06 9:02
BlackDice28-Mar-06 9:02 
GeneralRe: DirectX and tabpages Pin
melanieab28-Mar-06 9:15
melanieab28-Mar-06 9:15 
QuestionProblem with binding combobox with blank item Pin
Lav Pathak28-Mar-06 8:10
Lav Pathak28-Mar-06 8:10 
Hi,

I am working on windows .NET application.
Here I have few comboboxes which i bind with my datatable.
Now I wanted the first item to be blank item so After I queried my datatable from database, I add blank row at the top of my datatable and then bind my datatable to the combobox.

Following is the code to bind the combobox with first item as blank:

dsDataSet.Clear();<br />
theAdapter.Fill(dsDataSet, "Table");<br />
tblTable = dsDataSet.Tables("Table");<br />
myRow = tblTable.NewRow;<br />
<br />
myRow("DisplayField") = "";<br />
<br />
//------------------------<br />
myRow("KeyField") = 0;                   // ------>  keyfield as ZERO<br />
//--------------------------<br />
<br />
tblTable.Rows.InsertAt(myRow, 0);<br />
objCombo.DataSource = null;<br />
objCombo.Items.Clear();<br />
objCombo.DataSource = tblTable;<br />
objCombo.DisplayMember = "DisplayField";<br />
objCombo.ValueMember = "KeyField"; 



Now Problem is that after I bind the combobox, If i do following

cbo.selectedvalue= <somevalue>

Here my <somevalue> is the value of the first actual item after the blank.

it is throwing an exception.
------------
In Method: Void set_SelectedIndex(Int32)

Specified argument was out of the range of valid values.
Parameter name: '-2147483648' is not a valid value for 'index'.

-----------

Any idea why is this happening?

here using selected value i am selecting the first item after the blank item in combobox.


Thanks
Lav


Lav Pathak
Application Developer
Auxiliary Enterprises
Kalamazoo, MI
QuestionHow can i make a Panelarray ? Pin
summercoal28-Mar-06 7:14
summercoal28-Mar-06 7:14 
AnswerRe: How can i make a Panelarray ? Pin
Judah Gabriel Himango28-Mar-06 9:31
sponsorJudah Gabriel Himango28-Mar-06 9:31 
QuestionSelectable area of custom TabPage Pin
madsnowman28-Mar-06 6:39
madsnowman28-Mar-06 6:39 
QuestionSend Mail in C# 2005 Pin
ahchoo28-Mar-06 6:09
ahchoo28-Mar-06 6:09 
AnswerRe: Send Mail in C# 2005 Pin
Luis Alonso Ramos28-Mar-06 6:20
Luis Alonso Ramos28-Mar-06 6:20 
GeneralRe: Send Mail in C# 2005 Pin
ahchoo28-Mar-06 6:34
ahchoo28-Mar-06 6:34 
GeneralRe: Send Mail in C# 2005 Pin
Luis Alonso Ramos28-Mar-06 6:39
Luis Alonso Ramos28-Mar-06 6:39 
GeneralRe: Send Mail in C# 2005 Pin
Susan Hernandez29-Mar-06 14:56
Susan Hernandez29-Mar-06 14:56 
QuestionGraphics.DrawImage half pixel clip and shift? Pin
vineas28-Mar-06 5:33
vineas28-Mar-06 5:33 
AnswerRe: Graphics.DrawImage half pixel clip and shift? Pin
J. Dunlap28-Mar-06 17:17
J. Dunlap28-Mar-06 17:17 
GeneralRe: Graphics.DrawImage half pixel clip and shift? Pin
vineas29-Mar-06 2:38
vineas29-Mar-06 2:38 
QuestionHow to create own Custom Table Style For DataGrid Pin
brainthorburn28-Mar-06 4:28
brainthorburn28-Mar-06 4:28 
QuestionSorting Collection Pin
England100028-Mar-06 4:03
England100028-Mar-06 4:03 
AnswerRe: Sorting Collection Pin
Kamal.Afridi28-Mar-06 6:34
Kamal.Afridi28-Mar-06 6:34 
GeneralRe: Sorting Collection Pin
England10002-Apr-06 22:41
England10002-Apr-06 22:41 
QuestionControl Focus Problem - a Bug? or.. Pin
rnvrnv28-Mar-06 3:12
rnvrnv28-Mar-06 3:12 
AnswerRe: Control Focus Problem - a Bug? or.. Pin
Luis Alonso Ramos28-Mar-06 6:23
Luis Alonso Ramos28-Mar-06 6:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.