|
hi to all,
i need to define a form that will alyaws be on top of all other forms in my application.
i did that by setting the property TopMost = true.
the problem is that when i go into another win application (windows explorer for example) my form is still on top.
does someone knows how to define the form as a TopMost form but only for the c# application.
best regards and thanks in advance
fady
|
|
|
|
|
Hi,
You can try YourFormObject.BringToFront(). It will leave your form on top over all other forms of your application but you can access to another application without problems.
I hope that helps you.
X-TroLL
|
|
|
|
|
Hi. I am a newbie in programming C#, and am having a mental block. I am programming for the pocketPC.
I have a Combobox named "Type" and have a list there. I want to show the results of the entry from the combobox into a text label.
For example,
I pick "fruit" from the combobox.
I want to display on the screen: "This food is a fruit"
If I pick "vegetable" from the combobox, it should display:
"This food is a vegetable"
Right now, I'm getting:
"This food is a 1"
"This food is a 2"
How can I make the 2 into vegetable?
This is what I have, and I have a feeling it has to do with the GetValue and/or GetOrdinal.... I just can't seem to get it to work....
TypeLabel.Text = rReader.GetValue(rReader.GetOrdinal("MovieType")).ToString();
Thanks... Sorry for such a dumb question. If I haven't given you enough code, let me know. I can always add more.
|
|
|
|
|
try this
on comboBox1_SelectedIndexChanged event write this code
this.textBox1.Text = this.comboBox1.Text;
//each item u select from combobox the text of selected index should appear in textbox
I hope this helps
|
|
|
|
|
Thank you so much!
I will try it out immediately and let you know!
Thanks again!
|
|
|
|
|
Never Mind dude we are here to helps each-others
|
|
|
|
|
Okay, I thought I understood what I'm doing, but it's not really working.
I added this:
this.GLabel.Text = this.TypeCombo.Text;
To the Windows Form Designer generated code.
I added this:
OnTypeCombo_SelectedIndexChanged "1" write male;
It gives me the following error:
Invalid token "1" in class, struct, or interface member declaration.
|
|
|
|
|
Hello!
Oh my bad...try this in windows for designer:
this.combobox1.SelectedIndexChanged += new System.EventHandler(this.combobox1_SelectedIndexChanged);
then have this code inside the EventArgs:
this.Label.Text = this.combobox1.SelectedItem.Text
hope that works
Aim small, miss small...
-- modified at 1:02 Thursday 15th December, 2005
|
|
|
|
|
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.textBox1.Text = this.comboBox1.Text;
}
//this code must work, i tested multiple time and works fine.
I hope u fill combobox in onLoad Event of ur Form or u fill combobox from another event
|
|
|
|
|
Thanks guys!
Off to the new "challenge"!!!!
|
|
|
|
|
Well, it worked. 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):
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"))));
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();
<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.
Thanks guys,
M.
-- modified at 14:30 Thursday 15th December, 2005
|
|
|
|
|
I am working on classlibrary project in which I have to write a class which supports both oracle as well as sqlserver.Which Data object i should use?
-- modified at 7:09 Wednesday 14th December, 2005
|
|
|
|
|
Hi,
You can use a Factory which uses two object like this :
the following objects inherite of DataObject (your main class)
- DataObjectOracle
- DataObjectSqlServer
Your main class : DataObject will be used by an object DataObjectFactory
Your new object DataObjectFactory will be used by all your objects whose need access to database. In your factory object you must declare a method which must be static and have a parameter type of string.
Parameter contains the name of your wanted object.
For more information see the following link which demonstrate by picture my thing : http://www.dofactory.com/Patterns/PatternPrototype.aspx
X-TroLL
|
|
|
|
|
How can i convert Hexadecimal into binary an vice versa
|
|
|
|
|
What does the first link show?[^]
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Convert from hexadecimal to numeric, then from numeric to binary. The other ways goes... well... the other way...
---
b { font-weight: normal; }
|
|
|
|
|
Hi Friends,
If anybody knows the procedure to convert Julian time calendar date to dd-mm-yyyy format, plz help me.
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Take a look here[^], or here[^].
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
at run time a create a table with 20 row , then set it to Datagrid but data grid also shows 21st extra row to enter data. How can i prevent that.
|
|
|
|
|
set the datagrid's ReadOnly property to true, or set the dataview's AllowNew property to false
|
|
|
|
|
|
Hi everybody,
I have a big problem with listbox . I created a user control which contains two listboxes and two buttons to permit switch a single or multiple items from listbox1 to listbox2.
When I click into vertical scrollbar (not on the track button but inside the scrollbar, it moves itself to place the selected item on bottom of the active listbox . My problem is that play only at the first time that I use the listbox (after the form load event)
I hope have clearly explain my problem and hope someone help me.
PLEASE.......... HELP ME !!!!!!!!!
Thanks for help.
X-TroLL
|
|
|
|
|
|
hi to all,
how can i put a link label in a listview cell ? and how to fire an event when i click the data in the cell ?
best regards and thanks in advance
fady
|
|
|
|
|
I have the following within my myWall Class:
<br />
private Point _wallLocation = null;<br />
<br />
public myWall(Point newLocation)<br />
{<br />
this._wallLocation = newLocation;<br />
}<br />
This returns a compile time error of:
Cannot convert null to 'System.Drawing.Point' because it is a value type
So I have to use one of the following two options and either make it:
<br />
private Point _wallLocation;<br />
or
<br />
private Point _wallLocation = new Point(1,1);<br />
I am new to C# (< 5 days) with a C background, so to me the first option isn't good because I have an unassigned variable kicking around. The second option isn't any good because I am wasting resources allocating a Point that I will never use.
What is the best way to allocate a ValueType that has nothing stored in it if I can't null it?
If I use the first example does that mean that the Point is actually allocated? If so does it have random data in it? This would imply that the two options above cost exactly the same processor wise.
Thanks.
-Rowan
|
|
|
|