|
Hi...
I need to enable my Apply button only when the user edits something on the form (I have datagrids, text-, check-, comboboxes). All of them are bounded to a Databinding.
What's the best way to get this behaviour?
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
With a keypress event
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I'd bind the "Enabled" property to my business object. So when value gets changed there, it gets enabled/disabled automatically. Check this[^] article.
|
|
|
|
|
In a textbox_input_textchanged event put button_apply.enable = true
|
|
|
|
|
how to Change crystal reports Runtime Location of OLE Object
|
|
|
|
|
I have created the excel object which creates a process Excel.exe, see the code below
Microsoft.Office.Interop.Excel.Application Excelobj = new
Microsoft.Office.Interop.Excel.Application();
Excelobj.quit();// calling this doesn't ends the Excel.exe so how do i kill
this excel.exe
|
|
|
|
|
Have you used Marshal.FinalReleaseComObject() on every COM object? Have you set them to null ? Finally, have you used GC.Collect() once when you've finished doing those things?
|
|
|
|
|
// I have used this function still problem persists
protected void killExcel(Microsoft.Office.Interop.Excel.Application exc)
{
try
{
List<microsoft.office.interop.excel.workbook> wbs = new List<microsoft.office.interop.excel.workbook>();
List<microsoft.office.interop.excel.worksheet> wss = new List<microsoft.office.interop.excel.worksheet>();
foreach (Microsoft.Office.Interop.Excel.Workbook wb in exc.Workbooks)
{
foreach (Microsoft.Office.Interop.Excel.Worksheet ws in wb.Worksheets)
wss.Add(ws); // collect worksheets
wbs.Add(wb); // collect workbooks
}
for (int i = 0; i < wss.Count; i++)
{
wss[i].Delete();
System.Runtime.InteropServices.Marshal.ReleaseComObject(wss[i]); // release it
wss[i] = null; // null it
}
for (int i = 0; i < wbs.Count; i++)
{
wbs[i].Close(null, null, null);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wbs[i]); // release it
wbs[i] = null; // null it
}
exc.Workbooks.Close(); // so you can close this
exc.Quit(); // so you can quit this
System.Runtime.InteropServices.Marshal.ReleaseComObject(exc); // release it
exc = null;
GC.Collect(); // this sets up the finalizers
GC.WaitForPendingFinalizers();
GC.Collect(); //apparently this kills it
GC.WaitForPendingFinalizers();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
// deal with it fool!
}
}
|
|
|
|
|
I'm using :
ApplicationClass appClass = new ApplicationClass(); -> open
appClass.Workbooks.Close();
appClass.Quit(); -> it close excel.exe
|
|
|
|
|
I found this in the documentation on one of the COM Release functions:
// Note that COM objects that raise events within a .NET client require two Garbage Collector (GC)
// collections before they are released. This is caused by the reference cycle that occurs between
// COM objects and managed clients. If you need to explicitly release a COM object you should call
// the Collect method twice.
So I do a double GC on the main app object if I've setup any event handlers for it.
|
|
|
|
|
Something else you can investigate. Are you checking the return value from System.Runtime.InteropServices.Marshal.ReleaseComObject()?
It contains the reference count on the object. Check the return value to see if it's not zero. It would be interesting to know if on those times when Excel refuses to exit, the ref count is not zero.
The documentation actually suggests calling ReleaseComObject in a loop UNTIL the return value is zero.
|
|
|
|
|
Hi, when I open a dbf table with dBALite I can see under Database Info whether a table is ANSI or not...
Is there a way to get the same information when I open that table in a C# program?
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Probably, but that would be something database specific...
Normally you don't need to care about the encoding. The database driver should give you string data as strings, not as encoded byte arrays.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Normally not... but the problem is that all language specific char may not be read correctly. For exemple instead of ü i get | ... to solve that problem I have to decode the table (this is already done)
The problem is that some times I get tables that are already encoded correctly... in that case I don't need to decode the table...
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Hi
I am with a cheque printing software, how can I print a forms textbox data with out the forms background
Thanks & Regards
modified on Thursday, July 24, 2008 3:39 AM
|
|
|
|
|
Have a look at the PrintDocument[^] class.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
I'm trying to connect remotely from phone to pc. Currently I tested it in cradle mode. When I tried running my program (which is in the phone) it occured an error: Cannot find DbNetlib.dll. However, when I tried a pc to pc wireless connection (using an emulator) it works. It connects to the server just fine. Does anyone know how I can make my PDA phone connect to the server? I'm just copying the .exe file of my project file by the way.
modified on Thursday, July 24, 2008 3:45 AM
|
|
|
|
|
harcaype wrote: Cannot find DbNetlib.dll
And do you expect that it SHOULD be able to find this dll ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
yes. Anyway, I was able to make it work now. Thanks though!
|
|
|
|
|
Hi All,
i need to call a c# code in my java program. i followed the approach given in the codeproject link: http://www.codeproject.com/KB/cross-platform/javacsharp.aspx but there are some issues in generating netmodule , which is required to perform further steps. but it is giving an error
"csc /debug /t:module "bin\Debug\\HelloWorld.dll"" exited with code 9009 on using post build event command line.
Command is:
E:\c#\getOLCont\getOLCont>csc /t:module form1.cs
the error is:
fatal error CS0009: Metadata file 'c:\Program Files\Reference
Assemblies\Microsoft\Framework\v3.0\System.Workflow.ComponentModel.dll'
could not be opened -- 'File is corrupt.'
i have tried the command on different machines but there is same result.
please tell a way to solve this problem.
Regards
Kapil
|
|
|
|
|
Hi,
I have a windows application and I have added a setup project to this application. Im using the custom installer class as I have to run a batch file after the application is installed.
For this, im using overriding the OnAfterInstall event of the base class and have added code there to start a new process that runs the batch file.
The problem is the OnAfterInstall Event is not raised at all. I have added message boxes to check if the events are raised. Also tried the OnBeforeInstall event but in vain.
Need a solution asap. Any help or directives on this wud be very helpful
Thanks,
Shri
|
|
|
|
|
Have you added the component to the custom actions window of your setup?
|
|
|
|
|
HI, I want to iterate only those rows of excel sheet where the data have written, means if user has filled only first 15 rows then my loop should iterate to 15 only,hO wcan i do that Below is sample code which iterates up to 65536 rows,unnecessarily ,but the data are present only in first 15 or 18 rows. Please give me a solution or an idea
This is my sample code
Microsoft.Office.Interop.Excel.Application Excelobj = new Microsoft.Office.Interop.Excel.Application();
if (Excelobj == null)
{
MessageBox.Show("Excel couldn't be started", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Workbook workbook = Excelobj.Workbooks.Open(fdgExcel.FileName,Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing , Type.Missing, Type.Missing);
Sheets sheets = workbook.Worksheets;
Worksheet worksheet = (Worksheet)sheets.get_Item(1);
for (int i = 2; i < worksheet.Rows.Count;i++ )
{
Range range = worksheet.get_Range("A" + i.ToString(), "C" + i.ToString());
}
|
|
|
|
|
int lastUsedColumn = worksheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing).Column;
int lastUsedRow = worksheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing).Row;
should tell you the last used row and column
|
|
|
|
|
i want to create crystal report for access(password protected)database.i do it bu this project run another computer error messege come loginfo.
please help.i want to diploy database datadirectory.i using visual studio 2005 exprees editon.(crystal report for .net framewort 2)
get more example.because i am biginner
|
|
|
|