Click here to Skip to main content
15,924,318 members
Home / Discussions / C#
   

C#

 
AnswerRe: Combobox Pin
albCode14-Dec-05 3:41
albCode14-Dec-05 3:41 
GeneralRe: Combobox Pin
SpeBeeTo14-Dec-05 3:46
SpeBeeTo14-Dec-05 3:46 
GeneralRe: Combobox Pin
albCode14-Dec-05 3:59
albCode14-Dec-05 3:59 
GeneralRe: Combobox Pin
SpeBeeTo14-Dec-05 6:36
SpeBeeTo14-Dec-05 6:36 
GeneralRe: Combobox Pin
tatchung14-Dec-05 19:01
tatchung14-Dec-05 19:01 
GeneralRe: Combobox Pin
albCode14-Dec-05 20:55
albCode14-Dec-05 20:55 
GeneralRe: Combobox Pin
SpeBeeTo15-Dec-05 1:28
SpeBeeTo15-Dec-05 1:28 
QuestionNew Combobox Challenge Pin
SpeBeeTo15-Dec-05 8:27
SpeBeeTo15-Dec-05 8:27 
Well, it worked. Smile | :) Thanks again.

I have another problem, errr, challenge now. I am using an SQL database to save the info the person chooses on one form (pedbone.cs).

Here's the code to the Combobox I've got on the "main" form (pedbone.cs):

// populate the list - gender<br />
                    m_cTypes = new ArrayList();<br />
                    m_cTypes.Add("Unknown");                      <br />
                    m_cTypes.Add("Male");<br />
                    m_cTypes.Add("Female");<br />
                    TypeCombo.DataSource = m_cTypes;


These are listed in a ListView
<br />
			SqlCeCommand sqlLoadEvents = m_cConn.CreateCommand();<br />
			sqlLoadEvents.CommandText = szSQL;<br />
			SqlCeDataReader rReader = sqlLoadEvents.ExecuteReader();<br />
		<br />
		while ( rReader.Read() )<br />
			{<br />
				 				lvItem.SubItems.Add(GetTypeFromNumber ((int)rReader.GetValue(rReader.GetOrdinal("MovieType"))));// Gender				<br />
                CollectionList.Items.Add( lvItem );<br />
			}<br />
		}


And here I got the Combobox text to show in the ListView, by using this code

private string GetTypeFromNumber(int nTypeID)<br />
    {<br />
        return (m_cTypes[nTypeID].ToString());<br />
    }


Now, when you click on the listview item, a new form opens up (AddEditMovieForm.cs) to view the file in more detail. And here's where I'm running into a bit of a bind.

public AddEditMovieForm(SqlCeConnection cConn, int nMovieID)<br />
                {<br />
                        InitializeComponent();<br />
<br />
                        m_cConn = cConn;<br />
                        m_nMovieID = nMovieID;<br />
                        m_cTypes = new ArrayList();<br />
<br />
                        if ( m_nMovieID != -1 )<br />
                        {<br />
                        SqlCeCommand sqlCommand = m_cConn.CreateCommand();<br />
                        sqlCommand.CommandText = "SELECT * FROM MOVIE_MNGR_TABLE where MovieID = "+m_nMovieID.ToString();<br />
<br />
<br />
                                SqlCeDataReader rReader = sqlCommand.ExecuteReader();<br />
                                if ( rReader.Read() )<br />
                                {<br />
<br />
        }<br />
<br />
                                        {<br />
<br />
      GenderLabel.Text = rReader.GetValue(rReader.GetOrdinal("MovieType")).ToString();// Gender<br />
<br />
                                                                                        {<br />
                                                                                }<br />
                                        }<br />
<br />
<br />
                                }<br />
                        }


Any help would be appreciated. I would like to add "male" or "female" into the GenderLabel.Text field. If I neglected to add any important code, please let me know. Smile | :)

Thanks guys,

M.

-- modified at 14:30 Thursday 15th December, 2005
QuestionCan somebody suggest me which Data Object to use in a database independent project(oracle or sqlserver) Pin
YogeshChoudhary14-Dec-05 1:08
YogeshChoudhary14-Dec-05 1:08 
AnswerRe: Can somebody suggest me which Data Object to use in a database independent project(oracle or sqlserver) Pin
xtroll14-Dec-05 1:41
xtroll14-Dec-05 1:41 
QuestionConversion of Hexadecimal into Binary format Pin
kansalSunny14-Dec-05 0:44
kansalSunny14-Dec-05 0:44 
AnswerRe: Conversion of Hexadecimal into Binary format Pin
Vikram A Punathambekar14-Dec-05 1:15
Vikram A Punathambekar14-Dec-05 1:15 
AnswerRe: Conversion of Hexadecimal into Binary format Pin
Guffa14-Dec-05 1:15
Guffa14-Dec-05 1:15 
QuestionTo Convert Julian Time Calendar Date? Pin
MudkiSekhon14-Dec-05 0:29
MudkiSekhon14-Dec-05 0:29 
AnswerRe: To Convert Julian Time Calendar Date? Pin
Polis Pilavas14-Dec-05 2:04
Polis Pilavas14-Dec-05 2:04 
Questionextra row in datagrid Pin
Greeky14-Dec-05 0:16
Greeky14-Dec-05 0:16 
AnswerRe: extra row in datagrid Pin
J4amieC14-Dec-05 0:40
J4amieC14-Dec-05 0:40 
GeneralRe: extra row in datagrid Pin
Greeky14-Dec-05 0:51
Greeky14-Dec-05 0:51 
Question[URGENT] : How to capture ListBox vertical scrollbar position Pin
xtroll14-Dec-05 0:03
xtroll14-Dec-05 0:03 
Answer[Resolved] - [URGENT] : How to capture ListBox vertical scrollbar position Pin
xtroll14-Dec-05 4:55
xtroll14-Dec-05 4:55 
Questionlink label in listview cell c# win forms Pin
fady_sayegh13-Dec-05 23:58
fady_sayegh13-Dec-05 23:58 
QuestionHelp understanding value types Pin
-Rowan-13-Dec-05 23:45
-Rowan-13-Dec-05 23:45 
AnswerRe: Help understanding value types Pin
GDavy14-Dec-05 0:06
GDavy14-Dec-05 0:06 
AnswerRe: Help understanding value types Pin
xtroll14-Dec-05 0:13
xtroll14-Dec-05 0:13 
AnswerRe: Help understanding value types Pin
Vikram A Punathambekar14-Dec-05 1:25
Vikram A Punathambekar14-Dec-05 1:25 

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.