|
if u are working i will let u know my problem !
may it will make a bit easier!
see in the second URL there is a class MyDataGrid which is inherited from DataGrid
which have two protected override funtions OnMouseMove and OnMouseDown which were not working then i realize that may the events should be registered and i tried this syntax to register
this.dataGrid1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove);
this.dataGrid1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnMouseDown);
where i got errors like
Method 'System.Windows.Forms.Control.OnMouseDown(System.Windows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs )'
Method 'System.Windows.Forms.Control.OnMouseMove(System.Windows.Forms.MouseEventArgs)' does not match delegate 'void System.Windows.Forms.MouseEventHandler(object, System.Windows.Forms.MouseEventArgs )'
|
|
|
|
|
something like this should work while initializing the component
this.dataGridView1.Columns[0].Resizable.Equals(false);
However, I dont know how far this will work in 2003.
Keshav Kamat
India
|
|
|
|
|
hey u are telling me about 2005 version but mine is 2003:->
|
|
|
|
|
create an event handler for every DataGrid Column and its default width there
myDataGridColumn.WidthChanged+=new EventHandler(myDataGridColumn_WidthChanged);<br />
<br />
private void myDataGridColumn_WidthChanged(object sender, EventArgs e)<br />
{<br />
myDataGridColumn.Width=50;<br />
}
|
|
|
|
|
error
'System.Windows.Forms.DataGrid' does not contain a definition for 'WidthChanged'
|
|
|
|
|
event is not present for data grid its for the DataGride Columns(Which are present in GridColumnStyle)
|
|
|
|
|
ya !
i know !
so do u have any idea what should i have to do?
|
|
|
|
|
go in Property od data grid and then click in TableStyle Then Go to GridColumnStyle. There see the name of your Columns and create event for every Columns as I said
|
|
|
|
|
i have done like this earlier!
but after setting the width when we run the program initially the widht is same as we coded but when mouse moves to the column header it allows user to cahnge the widht and i want to disallow this for user!
i.e. to fix the column width at coding time and disable resizable functioanlity for user.
|
|
|
|
|
dear you must be doing wrong. please reade carefully what i suggested you.
|
|
|
|
|
not getting!
can u explain in detail?
|
|
|
|
|
give me a pm on think2sameer@yahoo.com
|
|
|
|
|
Hello Bhavana,
perhaps this should work.
Search for, where the controls are being initialized. Below the initialization of the datagrid control, each column is being initialized.
for each column, or the column that you require, paste this code
this.Column1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
Please tell me if it works. hopefully, it should.
Keshav Kamat
India
|
|
|
|
|
hey!
since i m using a datatable as datasource for my datagrid and no database connectivity.
the initialize components have the initialization of components,dataGrid and form only and no column initialization there.
i m making datagrid whose datasource is datatable and putting the row elements manually. and i know datagridview(2005) have above properties but datagrid(2003) doesn't ahve these properties.
|
|
|
|
|
Ok. When you load the contents of a database table into the datagrid, get the count of the columns present, and after that for all the columns, you can make sure that the columns cannot be resized.
After loading the database table into the datagrid,
//this will get the count of the columns in the datagrid
DataGridColumnCount=dataGridView1.Columns.Count;
then in a for loop,
set the resizable property of each table to false.
// you are making sure that no column can be resized.
DataGridView1.Columns[i].Resizable=
System.Windows.Forms.DataGridViewTriState.False;
Keshav Kamat
India
|
|
|
|
|
I am not getting the columns property after the datagrid.
Mine is 1.1 version and it doesn't have such properties.
Can u please tell me in VS.NET 1.1?
|
|
|
|
|
Hello everyone, for awhile now I have been developing a notepad with tabs, kind of like the tabs in IE7 or Firefox. Well, it works perfect for the first default tab. And by perfect I mean I can cut,copy,and paste along with use word wrap.
When I go to create a new tab/document I cannot use the cut, copy, paste, and word wrap features. I really am stumped on this seeing how I'm very young and new to the programming world. Would it be possible to give me a little push in the right direction? Or maybe even a decent shove.
Thanks,
Ryan
|
|
|
|
|
I have databinding to a couple of textboxes. When i edit a textbox the data doesn't save unless I click on another control. Any ideas? Thanks to everyone for there help.
Here is the code I use for ending the edit and then updating the database:
BindingContext[DS_Entity1, "EV051"].EndCurrentEdit();
TA_EV051.Update(DS_Entity1.EV051);
|
|
|
|
|
write your update code in TextChange event of text box
|
|
|
|
|
With my app I can't update until the user clicks the save button. Is there a way to accomplish this to not hit update the DB until a toolbutton is hit.
David
|
|
|
|
|
With my app I can't update until the user clicks the save button. Is there a way to accomplish this to not hit update the DB until a toolbutton is hit.
|
|
|
|
|
Hi all,
i had encountered a weird problem when accessing the data from the serial port class.
When running the software in debug mode (executing the software thru the IDE), the program works without any hitches.
But when we run the software using the executable, the process of reading from the serialport is blocked resulting in another portion of the code reaching timeout.
When I read the BytesToRead function, it gets back 45 bytes, so i suppose we are recieving data. To me, it seems we cannot get the data out by reading.
execrpts of my code:
first we obtained the number of bytes that is present in buffer of the serial.
intToRead = rs232SerialPort.BytesToRead()
rs232SerialPort.Read(bData, 0, intToRead) <--- When we run the program using the executable, the process is blocked here.
We created an instance of the serial port usin:
objR232Driver = New System.IO.Ports.SerialPort("COM" + CStr(intPort),9600,ioParity.None,DataBits.8)
objR232Driver.StopBits = StopBits.One
Has anyone encountered this kind of weird situation before?
Thankz,
Kim Guan
|
|
|
|
|
.... U have created the instance of the serial port as "objR232Driver" and set all the necessary parameters.But you were trying to use some other object named "rs232SerialPort". Where you created the obj for the later serial port?
You can make use of the below lines of code:
System.IO.Ports.SerialPort rs232SerialPort = new System.IO.Ports.SerialPort("COM" + CStr(intPort),9600,ioParity.None,DataBits.8);
and Set the read time out to either 2 or 3 secs.
The code is:
rs232SerialPort.ReadTimeOut = 2000; (For 2 secs)
Then use ur read port function:
intToRead = rs232SerialPort.BytesToRead();
rs232SerialPort.Read(bData, 0, intToRead);
Instead of Read function you can also make use of readbyte function that shall be used later for finding out any Start_Communication_Byte or like that...
The snippet ll be:
System.IO.Ports.SerialPort rs232SerialPort = new System.IO.Ports.SerialPort("COM" + CStr(intPort),9600,ioParity.None,DataBits.8);
rs232SerialPort.ReadTimeOut = 2000; (For 2 secs)
intToRead = rs232SerialPort.BytesToRead();
byte[]bData= new byte[intToRead ];
for (int nIndex = 0; nIndex < intToRead ; nIndex ++)
{
bData[nIndex ] = (byte)(rs232SerialPort.ReadByte());
}
The above ll surely help you to get the data in the Serial port buffer.
Thanks & Rgds,
Sri..
|
|
|
|
|
Have you tried trapping exceptions from this snippet of code? That should help determine what the problem is.
Phil
|
|
|
|
|
Hello all,
I try to have user thread to perform update on the window form list
view item back color. However, I can see the new item was added each
time. However, the back color just not changed until I move the window
around. May I noe what code I had missing out?
Thank you very much!
delegate void OnGUIDelegate(int msgID, object param1, object
param2);
public void OnGUI(int msgID, object param1, object param2)
{
// Make sure we're on the right thread
if(listView1.InvokeRequired == false)
{
switch(msgID)
{
case GUIMessage.MSG_ERR:
if(param1 is string)
{
string strDate = DateTime.Now.ToLongTimeString();
string[] s = {strDate, (string)param1};
ListViewItem listViewItem = new ListViewItem(s);
listViewItem.StateImageIndex = 2;
listViewItem.BackColor = Color.FromArgb(255, 224, 192);
listView1.Items.Add(listViewItem);
isSave = false;
}
break;
case GUIMessage.MSG_INFO:
if(param1 is string)
{
string strDate = DateTime.Now.ToLongTimeString();
string[] s = {strDate, (string)param1};
ListViewItem listViewItem = new ListViewItem(s);
listViewItem.StateImageIndex = 0;
listViewItem.BackColor = Color.FromArgb(192, 255, 192);
listView1.Items.Add(listViewItem);
isSave = false;
}
break;
case GUIMessage.MSG_WARNING:
if(param1 is string)
{
string strDate = DateTime.Now.ToLongTimeString();
string[] s = {strDate, (string)param1};
ListViewItem listViewItem = new ListViewItem(s);
listViewItem.StateImageIndex = 1;
listViewItem.BackColor = Color.FromArgb(255, 255, 192);
listView1.Items.Add(listViewItem);
isSave = false;
}
break;
} // switch
}
else
{
// Update GUI asynchronously
OnGUIDelegate onGUI =
new OnGUIDelegate(OnGUI);
this.BeginInvoke(onGUI,
new object[] { msgID, param1, param2});
}
}
|
|
|
|