|
thank you. It helped.
But I still have one little problem. How to make the first column with checkboxes?
I've tried first to make gridView with three columns. and the first was checkboxes. But when I make:
DataSet myDataSet = new DataSet();<br />
myDataSet.Tables.Add();<br />
myDataSet.Tables[ 0 ].Columns.Add();<br />
myDataSet.Tables[ 0 ].Columns.Add();<br />
myDataSet.Tables[ 0 ].Columns.Add();<br />
myDataSet.Tables[ 0 ].Rows.Add( new object[] { true,"aaa", "bbb" } );<br />
myDataSet.Tables[ 0 ].Rows.Add( new object[] { true, "aaa", "Bbb" } );<br />
dataGrid.DataSource = myDataSet.Tables[ 0 ];
Thats adds 3 more columns to my gridView.
-- modified at 12:10 Sunday 27th November, 2005
And i want to make in gridView 3 columns total. And first checkboxes.
|
|
|
|
|
How about this?
DataSet myDataSet = new DataSet();
myDataSet.Tables.Add();
myDataSet.Tables[ 0 ].Columns.Add( "My Bool", typeof( bool ) );
myDataSet.Tables[ 0 ].Columns.Add( "My String 1", typeof( string ) );
myDataSet.Tables[ 0 ].Columns.Add( "My String 2", typeof( string ) );
myDataSet.Tables[ 0 ].Rows.Add( new object[] { true,"aaa", "bbb" } );
myDataSet.Tables[ 0 ].Rows.Add( new object[] { true, "aaa", "Bbb" } );
dataGrid.DataSource = myDataSet.Tables[ 0 ];
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
super! thank you very much!
|
|
|
|
|
No problem, 'gator. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
how can i call a function, run code, etc. when the mouse moves? i looked at on mousemove, but it is only activated when the mouse is over the control.
thanks in advance,
sam kline
http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450
YES
|
|
|
|
|
I don't know if such thing is possible (I never neaded to do something like this). But you can check for mouse movement with the position of the curssor.
Either do a procedure that checks if the current mouse position differs from the previous (and act in consequence) and run it at a timer elaped interval, or try running it on a separate thread that may communicate with your main thread on mouse move (determined by the initial pocedure).
Momentaly I have no time avaliable in order to give you a code example...
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
|
i looked at that article, and used the class. it works perfectly. thanks for the link.
sam kline
http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450
YES
|
|
|
|
|
Sam,
Glad the suggestion worked out for you. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
If you target windows platforms only, it's very easy to use DirectInput.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have 1 form, 1 class and 1 table(from access).
I loaded the info from the table into the class and then added it all to an array list(on the form).
Now on the form i have a list box, with city names(which comes from the dataTable), nd in the dataTable i have some numbers next to each city name.
My question is how can i access these numbers that are stored in my arrayList to put into a formula(or to display when i select a city from the list).
If some can help me i would really appreciate it - this is really important.
|
|
|
|
|
The ListBox can hold any object in its list. You could do something like the following:
listBox.Items.Add( new City( cityName, cityNumber ) );
public struct City
{
public City( string name, int number )
{
this._name = name;
this._number = number;
}
public override string ToString()
{
return name;
}
public string CityName
{
get
{
return this._name;
}
}
public string CityNumber
{
get
{
return this._number;
}
}
} Then, later on, when someone has selected something in the list and you want to know what it is, you can use the following:
City c = ( City ) listBox.Items[ listBox.selectedIndex ]; You can then access the number stored in your City structure.
You can see an example of using this in my article Building the CVS Root File Changing Utility where I store a filename and CVS Root value in each item of the list so that I can later retrieve the information when someone clicks a button.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hey thanks alot that worked...i got a project due tomorrow.
T hanks alot for your help, really appreciate it.
|
|
|
|
|
I like the fact that I could help. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello,
I created a dataGrid based on a parameter query, on the same form of the dataGrid there is a comboBox with values. when I change the selection in the combo I want the DataGrid to change accordingly.
on SelectedIndexChange event for the combo, I send the value as a parameter to the dataAdapter, then fill the dataSet and refresh the dataGrid.
for some reason the grid is not refreshed.
this is my code:
private void re()
{
oleDbDataDetail.SelectCommand.Parameters.Add ("@vak",OleDbType.Integer ).Value=int.Parse(comboBox1.Text );
dataSetDetail.Clear();
oleDbDataDetail.Fill(dataSetDetails);
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{re();
dataGrid1.Refresh ();
}
any ideas?
Thank You!!!
|
|
|
|
|
If I am not mistaking your code will add a suplientary parameter (named "vak") every time a new item is selected in the combo box. But adding I don't think it will replace the old one, it jut will ad a new one. So when you are querrying the database, the result comes from the old (firs seted) parameter.
try using
oleDbDataDetail.SelectCommand.Parameters["@vak"] = int.Parse(comboBox1.Text );
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Hi,
Thanks.
I tried that, but I get a converting type error.
I tried without parsing the value to int, but it doesnt work.
any ideas on how to fix the problem?
thank u!
|
|
|
|
|
The basic ideea is to create your command, add a parameter to it (the parameter must corespond to the database's right value type) and change the parameter value (adding by reference) every time you querry.
If you've done this and still recive erors, in order to be helped post them ...
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Thank you.
I once added the parameter (on load form)
and then assigned a value to it.
Paramters["@vak"].value =.. ...
Thanx again!
|
|
|
|
|
i load a report in CrystalReportViewer.
i want to scroll down by pressing page down, but this event it's not handle by crystalReportViewer.
i used before Crystl32.OCX or Crystal control 9 , with these two control i could scroll down by pressing page down.
Need help ASAP
thx
|
|
|
|
|
Hello,
I am new here as far as posting goes.
Maybe someone can see what I'm Missing.
1)I am Getting Invalid Token @ (Account); - DisplayComposeForm(Account);
2)Member Modifier must precede the member type and name for "new" in the PictureBox1 -
3)For "Bitmap" -
(Class Struct, or interface must have a return type.
4)Identifier Expected - for -
string[] attachments = new string[] { cameraDialog.filename};
Does anyone see anything wrong here?
string account = "ActiveSync";
string to = "";
string subject = "";
string body = "";
string[] attachments = new string[] { cameraDialog.filename };
Microsoft.WindowsMobile.PocketOutlook.MessagingApplication.DisplayComposeForm(Account);
Label1 text = "Image sent sucessful";
PictureBox1.image new Bitmap(cameraDialog.filename);
This is straight from Neil Enns tut yet It doesn't seem to work.
I have run through the Blogging App Tut and for some reason I keep getting Build errors on this - Yet all Looks Correct?
Any suggestions?
Thanks =)
-- modified at 1:45 Sunday 27th November, 2005
|
|
|
|
|
Here is the full source.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.PocketOutlook;
namespace TOYOURSPACE
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void menuItem1_Click(object sender, EventArgs e)
{
Microsoft.WindowsMobile.Forms.CameraCaptureDialog cameraDialog = new Microsoft.WindowsMobile.Forms.CameraCaptureDialog();
cameraDialog.Owner = this;
cameraDialog.Title = "Take a Picture";
if ((cameraDialog.ShowDialog() != DialogResult.OK)(cameraDialog.FileName == ""))
{
return;
}
string account = "ActiveSync";
string to = "";
string subject = "";
string body = "";
string[] attachments = new string[] { cameraDialog.filename };
Microsoft.WindowsMobile.PocketOutlook.MessagingApplication.DisplayComposeForm(Account);
label1.Text = "Hello Windows Forms!";
PictureBox1.image = new Bitmap(cameraDialog.filename);
}
}
}
Seems I am missing something - and I am fairly new to the C# smartphone Development.
It's Probably something very simple I'm overlooking.
|
|
|
|
|
hello, i have a question that i would really like to be answered as soon as possible. i don't know if this is possible. hopefully it is (if it isnt, let me know)
question 1-
is there a way i can find out where the mouse cursor is in relation to the screen resolution? for example, if the mouse is in the middle of the screen, return 50% (or just 50). if it is 1 quarter of the way over from the left side of the screen, return 25% (or just 25), etc.
question 2-
is there a way i can SET where the cursor is, in relation to the screen resolution. for example, if i have the number 50% (or just 50), move the mouse to the middle of the screen. if the number is 25% (or just 25), move the mouse to 1 quarter over from the left side of the screen.
doesnt matter if it returns or sets with 25% or 25. if someone answers this i will be very grateful!
thanks very much,
sam kline
http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450
YES
|
|
|
|
|
There are two main classes that could help you accomplish your goal
System.Windows.Forms.Screen
System.Windows.Forms.Form.MousePosition
These two classes work in screen coordintes.
Let's assume that all your processing is done in the only display of your computer, then a method that can give you the "relative mouse position" can be like this :
public void GetMouseRelativePosition(out double x, out double y) {
Size screenSize = new Size();
Point mousePosition = new Point();
screenSize.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
screenSize.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
mousePosition.X = System.Windows.Forms.Form.MousePosition.X;
mousePosition.Y = System.Windows.Forms.Form.MousePosition.Y;
x = ((double)mousePosition.X / screenSize.Width) * 100;
y = ((double)mousePosition.Y / screenSize.Height) * 100;
}
In order to set your "relative position" you have to make your own method which recives the relative poition and set's the mouse coursor position.
Good luck!
protected internal static readonly ... and I wish the list could continue ...
-- modified at 3:08 Sunday 27th November, 2005
|
|
|
|
|