|
I have a windows application and in a form page are a datagrid and 2 labels.
I want to print them but I printed the label over the datagrid.
Can somebody to help me.
<<<<
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(230, 0), this.Size));
this.InvokePaint(grdExpenseSheet, myPaintArgs);
myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(500, 300), this.Size));
this.InvokePaint(lbTSEmployeeContent, myPaintArgs);
}
>>>>>
|
|
|
|
|
Hello Folks,
I really wonder to know and unfortunately could not find any answer:
Is it possible to make a single row read-write enabled in a Windows forms datagrid?
I have a read-only datagrid and want to make a single-row editable with a button click.Is this really difficult????
PLEASE HELP
|
|
|
|
|
You could make a func that only permits that...
I don't know the datagrid class...
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
Normally not.
But you could derive from DataGridTextBoxColumn, override the Edit event and only call the base implementation when the rownum is the desired value.
You would then have to define the column styles by yourself and not let the grid handle all the work for you
|
|
|
|
|
If you are using DataGridTextColumns then you have access to the TextBox that gets placed when user tries to edit values and since you have access to this TextBox then you can also place event handlers to handle keypresses and in your handler you can do anything you like.
I have the following code in VB but is same basic concept:
<br />
<br />
' Add column<br />
textCol = New DataGridTextBoxColumn<br />
textCol.MappingName = "Binary Value"<br />
textCol.HeaderText = "BinValue"<br />
textCol.Width = 160<br />
ts1.GridColumnStyles.Add(textCol)<br />
AddHandler textCol.TextBox.KeyPress, AddressOf grdBitfield_keypressHandler<br />
textCol.TextBox.BackColor = Color.Yellow 'show edit box in yellow color<br />
<br />
<br />
Private Sub grdBitfield_keypressHandler(ByVal sender As Object, ByVal e As KeyPressEventArgs)<br />
'handle backspace and delete keys<br />
If e.KeyChar = Convert.ToChar(Keys.Delete) Then Return<br />
If e.KeyChar = Convert.ToChar(Keys.Back) Then Return<br />
<br />
If grdBitfield.CurrentCell.ColumnNumber = 5 Then 'BinValue column<br />
If Not (e.KeyChar = "0" Or e.KeyChar = "1") Then<br />
e.Handled = True 'get out immeditely<br />
End If<br />
Else<br />
e.Handled = True<br />
End If<br />
<br />
End Sub<br />
Hope that helps.
|
|
|
|
|
Firstly I would like to thank you for your attention.You know the DataGrid in WebForms.I want to use the same functionality on Windows forms.
Do you have any other code samples or web links for this?
|
|
|
|
|
I haven't worked much with web form datagrids; however, main difference I remember is that you can place buttons on it. You should be able to do the same with the windows datagrid.
Following are some links to help you: Datagrid with Progressbar[^], How to add selection controls to datagrid[^], and Edit anything in a datagrid.[^].
The concept is basically the same, you can either add event handlers for the TextBox property of the DataGridColumnTextBox or you can create a new class derived from DataGridColumnStyle.
|
|
|
|
|
Hi everybody,
can any one of you guide me to solve the following problem.
I have a property 'Properties' returns 'Editor' type object, which is a read only property of LookupEdit Control. now I am overloading the LookUpEdit control as MyLookUpEdit Control. in MyLookUpEdit Control i want to override the property 'Properties' to return an object of 'MyEditor' class. MyEditor class is derived from 'Editor' class. obvously it extends functionality of Editor class. whenever the user of 'MyLookUpEdit' access the propety 'Properties' it has to return the 'MyEditor' object
the problem is i dont have a copyconstructor in Editor class.
I hope I have explained the problem as it is.
regards,
Mohamed Hasan.
Contact him at: hasansheik@hotmail.com
hasansheik@yahoo.co.in
hasansheik@lycos.com
|
|
|
|
|
You don't need to write a copy constructor (nor can you write one). Why do you want to write one? What exactly is the problem you're facing?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
this is exactly my problem.
Class LookUpEdit {
private Editor editor;
public Editor Properties
{
get{
return editor;
}
}
}
I am deriving the above class
class MyLookUpedit :LookUpedit
{
public MyEditor Editor
{
get
{
/// I need something like this.
return (MyEditor)base.Properties;
}
}
}
here is the MyEditor's implementation
class MyEditor : Editor
{
MyEditor()
{
}
}
do you have an idea. please try this.
Contact him at: hasansheik@hotmail.com
hasansheik@yahoo.co.in
hasansheik@lycos.com
|
|
|
|
|
How you construct MyEditor is up to you. My guess is MyEditor will have additional data members, so you might want to fill them, in addition to Editor members, before returning it. Something like
class MyEditor : Editor
{
private additionMember;
public MyEditor(Editor d)
{
baseMember1 = d.baseMember1;
}
public int AdditionalMember
{
}
}
class MyLookUpedit :LookUpedit
{
public MyEditor Editor
{
get
{
MyEditor editor = new MyEditor(base.Properties);
editor.AdditionalMember = 20;
return editor;
}
}
}
Hope this helps.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
I am developing web service as well as a Winform client for transferring some data.
I just wand to know some of the exceptions during the transactions say for example
1. If web service as well as client is running in the same machine, if the IIS is not running means which exceptions will be thrown in the client side
2. If an error (say access violation) happened in the web service which exception will be thrown from the web service and how to catch in the client program
3.If the web service is running in the remote machine if the cline is unable to find the web service which exception will be thrown
4. If the web service is running in the remote machine and there is no network connection between the web service and the client , how it is possible to detect from the client side.
5.Each and every exception at run time is important for me for the cases like above.
Could any one provide some information or code sample regarding the same?
|
|
|
|
|
Hi,
I have made program (Export Database table to Excel Using ADO.net) of Excel version 2003 when i run the exe on Excel 2000 version it displays the follwing error
given below.
Actually my program converts Database table to Excel.
I have to give compatabilty for both version Excel 2000 and Excel 2003 and Excel 2002
I can find out from registry which version is installed when program starts.
The problem is to include Assembly.
I take refrence of Com (Microsoft Excel 9.0 ) for Excel 2000 ,Microsoft Excel 10.0 for Excel 2002
and Microsoft 11.0 for Excel 2003
If i include All these dll in one program it gives error when i run where Excel 2000 is installed .
I think that the solution for that If any one tell me to take web reference at run time
if anyone provide me the code for that
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IO.FileNotFoundException: File or assembly name Interop.Excel, or one of its dependencies, was not found.
File name: "Interop.Excel"
at ExcelFinal.Form1.button1_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
=== Pre-bind state information ===
LOG: DisplayName = Interop.Excel, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\Administrator\Desktop\
LOG: Initial PrivatePath = NULL
Calling assembly : ExcelFinal, Version=1.0.1976.20424, Culture=neutral, PublicKeyToken=null.
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Interop.Excel, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/Interop.Excel.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/Interop.Excel/Interop.Excel.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/Interop.Excel.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/Interop.Excel/Interop.Excel.EXE.
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
ExcelFinal
Assembly Version: 1.0.1976.20424
Win32 Version: 1.0.1976.20424
CodeBase: file:///C:/Documents%20and%20Settings/Administrator/Desktop/ExcelFinal.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
regards,
sanjeev
Everthing is possible
|
|
|
|
|
Hi.Kindly tell me how to interface usb using C# 1.1 .I want to design my own hardware and then insert into the usb port of the system,whether i have to write driver for this specific device or use vb6 control in C# for the above streaming device....thanks in advance.waiting for replys....
@hs@n
|
|
|
|
|
|
I've done a C# project with USB, using QuckUsb from Bitwise systems. I've even document some (still working on it) of the unmanaged APIs on PInvoke.net.
/\ |_ E X E GG
|
|
|
|
|
Hi all,
I want to run tlbimp programatically. I want to provide AddReference dialog as .NET IDE is providing.
User will provide the path of UnManaged dll and i will run tlbimp on it and generate assembly programatically.
can anyone tell how should i do it.
Thanks,
Tushar.
|
|
|
|
|
Hi,
I have one button in Winform. I want to call Windows Dial up Thr Win API after pressing the Button.
waiting for the code
Thanks & Regards
sanjeev
|
|
|
|
|
I have a treeview,there are many treenodes in the treeview.
I just want to change one treenode's height(not all the treenodes' height).
Can someone tell me how to do it?
|
|
|
|
|
I forgot it that the treeview was in windows form.
|
|
|
|
|
You can't do this with the TreeView from the FCL.
If you have to get this behaviour you'll have to write your own TreeView or take a look on the ones available here on CP.
Regards,
mav
|
|
|
|
|
Hey Everybody!
I am looking for a way to know how many objects has been serialized in my file (using the FileMode.Append).
I thought that the SerializationInfo.MemberCount property should give me that kind of information, but I was completly misunderstood it.
so, is there a way to know how many objects has been serialized into a file???
Thanks ! ! !
|
|
|
|
|
From MSDN:
The result of a unary + operation on a numeric type is simply the value of the operand.
Why have it when it does nothing?
There could be some use with it if it could do the same as Math.Abs...
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
Why? Because you can overload it. However, I don't know any example when it can be usefull, but still...
On the same page:
"User-defined types can overload the unary + and binary + operators"
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Yes but why define it on int?
You could still overload it
at another point.
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|