|
If I understand you correctly then if you add the following code to the program.cs then you will be able intercept messages being passed to your app. Hope this helps.
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
MessageFilter messageFilter = new MessageFilter();
Application.AddMessageFilter(messageFilter);
}
internal class MessageFilter : IMessageFilter
{
bool IMessageFilter.PreFilterMessage(ref Message m)
{
switch (m.Msg)
{
case 0x100: //MSG.WM_KEYDOWN
if ((int)m.WParam == (int)Keys.F1)
{
}
}
}
}
Mark
|
|
|
|
|
Hi,
How to fill a combobox with avalue from 20-100
Thankyou
YPKI
|
|
|
|
|
for(int i = 20; i <= 100; i++)
{
comboBox.Items.Add(i.ToString());
}
|
|
|
|
|
for(int i=20;i<=100;i++)
{
cmbName.Items.Add(i.ToString());
}
Hope this help..
|
|
|
|
|
I guess what you need is to Set minValue = 20 and maxValue = 100
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
how about property of it "Datasource" and "Display Memeber" ? what it use for ? how to use ?
|
|
|
|
|
Hi,
we can set a datatable to datasource.if u want to fill those numbers to combobox we need to loop & then fill datatable & then assign it to combobox.datasource property. Better to use "combobox1.items.add " & a loop .
Display member property is used when we have more no.of columns in a query
for ex: -
<b> SqlCommand cmm = new SqlCommand();
cmm.CommandText = "select Emp_Id,Emp_Name,Emp_Address from Employee";
cmm.CommandType = CommandType.Text;
cn.open();
cmm.Connection = cn;
DataTable dt = new DataTable();
SqlDataAdapter sqldt = new SqlDataAdapter(cmm);
sqldt.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "Emp_Name";
comboBox1.ValueMember = "Emp_Id";
cn.close();</b>
While Displaying it Displays employees Name & if u are going to save it in table then we can use
"comboBox1.selectedvalue" property were we get the Emp_Id
|
|
|
|
|
Hi,
i don't think u can have min value & max value for a combo box
Satish Pai B
|
|
|
|
|
i don understand what u mean "min value & max value" ? however i think that in my combo box just store some string values n id. and i want to ask u a bit more... does combo box can store more then 2 colume or fields. for eg: Emp_ID, Emp_Name, Emp_Gender,Emp_Phone.. ?
|
|
|
|
|
No Combo Box can store only 2 columns by 2 Properties
1.DisplayMember - This does the work a displaying a column
2.ValueMember - This does a work what value should be returned when a particular item is choose d.
Ex:-
EmpID EMP_Name
1 abc
2 def
3 xyz
when u select a Emp_name - "def" from combo box & if u use "combobox1.selectedvalue" then it returns 2 or if u select "xyz " then it returns 3
doesn't mind if u still didn't get it.Just reply for doubts.
|
|
|
|
|
does combo box control can show 2 column in its dropdownlist ?
|
|
|
|
|
|
Hi All
I am very new to C#,and i have to set background color of my form, i am trying to do like
Assembly myAssembly = Assembly.GetExecutingAssembly();
Stream testImage= myAssembly.GetManifestResourceStream("Test.jpg");
but here it crashing.
can anybody help me out
thanks in advance
RYK
|
|
|
|
|
Form has BackGroundColor and BackGroundImage property. Use it.
जय हिंद
|
|
|
|
|
?? I don't know what you want, but if you want to change background color of a form, just do like this:
MyForm myForm = new MyForm(); // Here is your form
myForm.BackColor = System.Drawing.Color.Red; // Change the background color to red.
|
|
|
|
|
No No, i want to set a image file
|
|
|
|
|
Use BackGroundImage Property of ur form!(Singl-Click on ur form, then press F4. and use BackGroundImage Property to set an image.
[]D @ []v[] []D @ []v[]
|
|
|
|
|
There is no any option bcakgroungimage that is what i was asking
|
|
|
|
|
no MR.VC_RYK there is a property just arrange the properties in alpahbetical order and just below BackColor the BackgroundImage will be found........search and use it....
Padmanabhan
modified on Friday, May 29, 2009 4:25 AM
|
|
|
|
|
it is impossible...! i check it right now...when u select ur form, from the form properties(F4), Click on BackgroundImage, then use Import... and select ur image with ( *.gif, *.jpg, *.jpeg, *.bmp, *.wmf, *.png ) suffixes.
I hope u see it!
[]D @ []v[] []D @ []v[]
|
|
|
|
|
The BackgroundImage property has been a part of every control since .NET 1.0, so I am sure it exists in yours! Are you sure you have a form, not a console application? Can you open the designer view on it? If so, then check the properties are listed A-Z and that you aren't viewing the events. If really desparate, try using intellisense and check it programatically:
frmMine fm = new frmMine();
fm.BackgroundImage = @"C:\Pic.jpg";
If this comes up with errors, then paste your code here, with the error message.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
I'm using VS2008 and it's working just fine...
|
|
|
|
|
For Setting the background image of your form
YourFormNAme.BackGroundImage = YOUR-Application-NameSpace.Properties.Resources.YOUR-Resource-Name;
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
Hi All,
I am using Visual Studio 2005, .Net 2.0. In my application, i am using more number of Designer Host instances, So when i am using more than 36 instances of Designer Host, i cant able to resize the controls. If the number of instances of Designer Host is less than equal to 36 , then it is working fine.
Below is the link of an example given by the microsoft. It is also giving the same problem when adding more than 36 forms(i.e. Designer Host Form).
http://msdn.microsoft.com/en-us/magazine/cc163634.aspx
Can anyone please give me a solution.
Thanks & Regards,
Vaira Muthu.
|
|
|
|