|
Hello
There is no Maximized event to override. Instead try overriding SizeChanged event.
Something like this:
SizeChangedHandler(params...)
{
if(WindowState == Maximized)
{
if(Height > Screen.PrimaryScreen.WorkingArea.Height)
{
Top = 0
}
else
{
Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2; //To center the Form vertically
}
if(Width > Screen.PrimaryScreen.WorkingArea.Width)
{
Left = 0;
}
else
{
Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2; //To center the Form horizontally
}
}
}
|
|
|
|
|
As you said ur winform in MaximumSize then so u want ur winform in always maximized state right.. use Form's MaximizeBox property to disable Maximize button.
this.MaximizeBox = false;
Hope this helps u..
|
|
|
|
|
Hi!
I'm building a big xml string with a for loop and it takes veeeeeeeeeeeeeery much to complete this process. Later on I load it in an XmlDocument and save it in a file. This last thing takes no time.
The loop is something like:
<br />
string xml = "<Top>";<br />
for (int i=0; i < <ArrayList>.Count; i++){<br />
<br />
xml += "<Something>";<br />
xml += bla bla;<br />
xml += "</Something>";<br />
xml += <Object>.ToXml();
...<br />
...<br />
<br />
}<br />
xml += "</Top>";<br />
I know than the process may not be linear in time, but is there any known way to speed up this proccess? When the thing gets big (2MB xml file) it's really annoying to wait tons of minutes for this to save.
Thanx for any help!
|
|
|
|
|
For this you should use the StringBuilder Class.
Here I made a Method wich gives back a string.
public string CreateText(string[] textarray)
{
if(textarray != null)
{
StringBuilder lsb_Format = new StringBuilder();
for(int x=0; x < textarray.Length; x++)
{
lsb_Format.Append(textarray[x]);
}
return lsb_Format.ToString();
}
return "";
}
All the best,
Martin
|
|
|
|
|
|
hi,
Y dont u directly write it into file?
By adding string it consumes much more memory, try using StringBuilder.
Its available in System.Text namespace.
Thanks
Sushant Duggal.
|
|
|
|
|
Hai all,
I have a problem datagrid in Winforms about getting the selected row containing cells value,I know this is very simple in web application but i am new for win application can you please give the idea.
ranandbe
|
|
|
|
|
Hi,
If u want each column value of selected row then loop it with ColumnNumber
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber,
DataGrid1.CurrentCell.ColumnNumber)
|
|
|
|
|
Hi thanks for reply,
I can't get the Item property for that grid in Windows Forms Application, i thought you mentioned the web form grid control, is there any way to get web form grid control to win forms application.
ranandbe
|
|
|
|
|
yes in windows application only
u wil have item property check once again
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, DataGrid1.CurrentCell.ColumnNumber)
End Sub
|
|
|
|
|
How can i use RowFilter Property of DataView in C#?
|
|
|
|
|
RowFilter is used when you want to display some but not all rows of datatable based on some criteria. This criteria is specified in RowFilter. It is similar to that of using WHERE clause in your SELECT query.
For more reference please visit:
http://davidhayden.com/blog/dave/archive/2006/02/11/2798.aspx[^]
Regards,
Ketan.
|
|
|
|
|
How can we notify the client that the task has been completed by the windows service
|
|
|
|
|
i want to insert elemet of a array of ArrayList in a DataGrid. but how.plz help me.
|
|
|
|
|
Hope this helps you;
ArrayList.Rows.Clear();
for(int _x=0;x<ArrayList.Count;x++)
{
DataRow _row = DataTable.NewRow();
_row["???"] = ArrayList[x];
DataTable.Rows.Add(_row);
}
All the best,
Martin
|
|
|
|
|
See this example:
ArrayList arrayList = new ArrayList();
arrayList.Add(1);
arrayList.Add(2);
arrayList.Add(3);
DataTable dataTable = new DataTable("Table1");
dataTable.Columns.Add(new DataColumn("Column1", typeof(int)));
foreach(int i in arrayList)
{
DataRow dataRow = dataTable.NewRow();
dataRow["Column1"] = i;
dataTable.Rows.Add(dataRow);
}
this.dataGrid1.DataSource = dataTable;
|
|
|
|
|
Hi,
I have a big solutions which includes many c# projects and c++ projects. Some c++ project use the dll files generated by the c# projects. Now I begin to migrate the whole solution to 64-bit platforms. After setting the project, I found all the c# projects in this solution can not generate the expected dlll files.
I am a little confused. Could you help me if you are familiar with this?
Thanks a lot.
-- modified at 1:44 Thursday 29th June, 2006
|
|
|
|
|
As far as I know, there is no 64 bit compiler for C# or C++.NET. But for C++ (unmanaged) you can use for example Intel C++ Compiler.
|
|
|
|
|
I'm currently working on a monitoring system for tank overflows. I am using C#.net on a windows CE. How can I read and write to IO ports on Windows CE? What dll should I use?
|
|
|
|
|
User SerialPort class that resides on
Namespace: System.IO.Ports
Assembly: System (in system.dll)
Hope this helps u
|
|
|
|
|
Hello,
Thanks for replying to my message. I can already read and write to serial port. My concern now is how to read and write to ports other that serial ports. Like if I want to write to an IO port with address (0x378) and I want to write the data 0xFF; something like that.
I tried to add to my project the following codes,...
[DllImport("inpout32.dll", EntryPoint = "Out32")]
internal static extern void Out32(short PortAddress, short data);
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
internal static extern short Inp32(short PortAddress);
public void PortOut(short address, short data)
{
Out32(address, data);
}
public short PortIn(short address)
{
Inp32(address);
}
but it is not working, maybe I used the wrong dll. By the way I am using WindowsCE and VSC#.NET 2005 version.Can you give me any ideas or maybe sample codes on how to do this. Thanks
|
|
|
|
|
Hello,
I'm using ADO.NET & MS Access. I'd like to know how can I determine if the datasource is writable. I mean what if the user if running the application from a CD and I try to update a row? Is there a special exception thrown or something?
.NET Framework version: 2.0
Please advise. Thanks.
|
|
|
|
|
If you attempt an update when the file isn't writable, it'll throw an OleDbException with the message "Operation must be an updatable query."
|
|
|
|
|
Thanks but is it possible to know in advance?
|
|
|
|
|
You might want to double check this before you waste your time. It may not even be possible to open an Access database unless the media it's on is writable. Easy enough to test...copy a small database to a floppy, lock it, then write a little code to read from the database on the disk.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|