|
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});
}
}
|
|
|
|
|
Hello everyone,
Can someone tell me how I can increase the Height of the rows in my ListView?
Thank you very much for your help.
Khoramdin
|
|
|
|
|
|
suppose a network path to a text is like this \\MY_REMOTE_PC(or the ip address)\sharedFolder\Myfile.Txt
how can i access this file from a hostPC using C#. what areas to dig-in to get an acquaintance. Any help would be greatly appreciated. I am pretty new to domain of C# but have started loving it.
please do reply.
With regards
Pankaj
|
|
|
|
|
wildpankaj wrote: how can i access this file from a hostPC using C#.
Like this:
using System;
using System.IO;
StreamReader sr = File.OpenText ("\\\\MY_REMOTE_PC\\sharedFolder\\Myfile.Txt");
while ((string input = re.ReadLine()) != null)
Console.WriteLine (input);
sr.Close();
/ravi
|
|
|
|
|
He Pankaj,
you can use the open file dialog as always. If you are able to access any computer from that machine, then this procedure will work
OpenFileDialog ofn = new OpenFileDialog();
ofn.Filter = "XML Files (*.xml)|*.xml";
ofn.Title = "Type File";
This opens a file dialog, where you get to choose the file of your choice. This file dialogue is for xml files. LikeWise you can set which files you want to choose. be careful of the extension though.
continue it with
if (ofn.ShowDialog() == DialogResult.Cancel)
goto Quit;
"Quit" defines a label, used in case, the user chooses cancel buttion of the open file dialog.
i hope this helps.
Keshav Kamat
India
|
|
|
|
|
Once You open the file, u can use the stream reader to read the contents of the file as Ravi has suggested.
Keshav Kamat
India.
|
|
|
|
|
I am attempting to execute a Surround SCM CLI Command using system.diagnostics.process. The cruisecontrol command to be exact. If I execute the command in command window it works perfectly. If I place and run the command from a batch file it works perfectly. When I execute it using the system.diagnostics.process it does not run, at least not completely. At the end of the command I use “> filename.txt” to dump the results to a text file. Again, it runs great in a command window and from a batch file but not in the C# app. Any ideas?????
<br />
<br />
System.Diagnostics.Process process = new System.Diagnostics.Process();<br />
process.StartInfo.FileName = @"c:\mypath\seapine\surround scm\sscm.exe";<br />
process.StartInfo.Arguments = " cc -d" + timecode + " -r -bMyBranch –pMy/Path -x- -z127.0.0.1:1234 -yUN:PW > FileName.txt";<br />
process.StartInfo.UseShellExecute = true;<br />
process.StartInfo.RedirectStandardOutput = true;<br />
process.StartInfo.RedirectStandardError = true;<br />
process.StartInfo.CreateNoWindow = true;<br />
process.Start();<br />
process.WaitForExit();<br />
<br />
|
|
|
|
|
The ">" doesn't work because you redirected the standard output stream away in your Process object.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I reset the redirection properties to false, and I am still getting the same results.
|
|
|
|
|
Try setting CreateNoWindow to False, after that, play with the UseShellExecute.
It'll work, but you have to get these settings correct to get it work correctly.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
By setting the CreateNoWindow to false, and UseShellExecute to true it ran twice. I changed the arguments property value and it quit working. I changed it back and it still won't work again.
I finally created a method that would create a batch file dynamically and I execute that using the diagnostics process and it works everytime.
Strange....
Thanks!
|
|
|
|