|
Release it.
Make the object NULL.
Cheers,
Suresh
|
|
|
|
|
I have already try that but still i found problem of memory leak.
please give me another solution.
|
|
|
|
|
maybe a bit of a hardcore solution, but you could instantiate your COM object in a separate application domain and when you don't need the COM object anymore drop the application domain, that should take care of the memory issue I think...
Greets,
Davy
|
|
|
|
|
Have you tried this:
System.Runtime.InteropServices.Marshal.ReleaseComObject(yourObject);
before you set your COM object to null?
|
|
|
|
|
Hello!!!!
I'm working with RichTextBox.
How can i make that if i push right button, the text (or only 1 position), that is under my cursor became Selected ? (as if i press left button ?).
One nation - underground
|
|
|
|
|
check the key event.
Keshav Kamat
India
|
|
|
|
|
|
HELLO, PRASAD.
this might be happenin because of the location of mouse.
you can use datagrid paint method and in that you have to write
MaskedTextBox Ma=new MaskedTextBox("0.0.0.0");
Ma.Top=grdPrescription.GetCurrentCellBounds().Top;
Ma.Left=grdPrescription.GetCurrentCellBounds().Left;
Ma.Width=grdPrescription.GetCurrentCellBounds().Width;
Ma.Height=grdPrescription.GetCurrentCellBounds().Height;
...
manas
|
|
|
|
|
i was just trying to solve it in my application.
dont worry abt "grdPrescription", its the name of the datagrid.
manas
|
|
|
|
|
Ew.
Instead of magically showing a masked text box over the cell that has been clicked, you may consider actually creating a masked text box CELL -
This requires creating a column and corresponding cell of your specific control type.
Here is a great tutorial on how to do this, I have used it to create several custom column and cell types:
http://msdn2.microsoft.com/en-us/library/aa730881(vs.80).aspx[^]
Yes, it is more work, but you get 3 things for free:
1. The grid will automatically show the control in the correct place.
2. The control can be databound, meaning it takes care of all the data transactions for you
3. It keeps your business code simpler by not involving the management of temporary text boxes.
------------
Cheers,
Patrick
|
|
|
|
|
Dear All
I am working on a drawing application using OpenGl and C#. I want to use the whole form as Drawing area, i have added menus to my application but these menus does not show at run time, help required
thanks
David
-- modified at 4:48 Tuesday 24th April, 2007
david
|
|
|
|
|
hi,
i want to extract only the class names from a C# file..
i have a pattern like this..
pattern: "\\s*(namespace|class)[^{]*"
but it gives matches along with the namespace and class keyword..
i want a pattern that can extract only class|namespace names from
the lines that are not commented in the source code..
plz help.
regards,
nas
|
|
|
|
|
Hi
Not sure if this was already asked, but I'm trying to find a way to get a certain text (or phrase) from a line in notepad using C#
example: (notepad)
>Name: Joseph Smith
>Address: Main Street
I need to get name (Joseph Smith) and the address only, ignoring the "name:" and "address:"
so far i only know how to read the entire line, but i have no idea how in the world i can isolate the desired text/phrase
Hope you guys can help. Thanks
|
|
|
|
|
If you can rely on a standard line format, it's pretty easy:
string line = "Name: Joseph Smith";
string[] parts = string.split(line, ":");
Then the parts[] array will contain the following strings:
parts[0] = "Name"
parts[1] = " Joseph Smith"
Note the space before Joseph. You could use string.Trim() to get rid of that, or you can modify the split to use StringSplitOptions.RemoveEmptyEntries.
I'm assuming you're using C#, here.
------------
Cheers,
Patrick
|
|
|
|
|
Why don't you try a xml file?
|
|
|
|
|
He specifically said he's getting a line from a text file in notepad and gave an example line. XML works nicely, yes, but unfortunately not everyone uses XML to store application information
------------
Cheers,
Patrick
|
|
|
|
|
Patrick Sears wrote: If you can rely on a standard line format, it's pretty easy:
string line = "Name: Joseph Smith";
string[] parts = string.split(line, ":");
Then the parts[] array will contain the following strings:
parts[0] = "Name"
parts[1] = " Joseph Smith"
Note the space before Joseph. You could use string.Trim() to get rid of that, or you can modify the split to use StringSplitOptions.RemoveEmptyEntries.
I'm assuming you're using C#, here.
------------
Cheers,
Patrick
Hi Patrick! thanks for the help. Yes, im using C#, but i received this error
"Error 1 'string' does not contain a definition for 'split'" for string[] parts = string.split(line, ":");
do i need to import something?
thanks again
|
|
|
|
|
Split isn't a static method.Use in in a object instance and take care of the case.
|
|
|
|
|
Sorry, xibeifeijian has it right - it's an instance method, I was just indicating what class it belongs to. Sorry about that
Sometimes I'm not sure if people will understand I'm speaking in pseudocode; sort of depends on experience level which I don't know up front.
Let me know if you need anymore help figuring out how to do the parsing!
------------
Cheers,
Patrick
|
|
|
|
|
I am using Document Library in MOSS to store MS Office files to make use of IRM in MOSS. (Web application)
I want to impose expire date at document level before uploading to
document library such that even if the document is downloaded on client machine, after expiry date, the document should not open.
Thus, is there any way to impose expire date on MS office files (excel/word/power point/ infopath) using C#?
Please guide.
-- modified at 22:21 Wednesday 13th June, 2007
Regards
Sachin
|
|
|
|
|
i don't know about using c# but i guess you could add a macro to the documents concerned to either delete their own contents or inform the user that the document has expired. I know MS were talking about creating expiring e-mail etc some while ago but i never heard if they implemented it.
Russell
|
|
|
|
|
Maco can be disabled while opening the document, thus will not be useful.
We were trying to add permissions to the file ojbetcs directoy using following code but that is giving very generalized exception
"Value does not fall within the expected range"
Please have a look at the code below
------------------------------------------
<br />
using System; <br />
using System.Collections.Generic; <br />
using System.Text; <br />
using Microsoft.Office.Core; <br />
using ExcelInterop = Microsoft.Office.Interop.Excel; <br />
using Microsoft.Office.Interop.Word; <br />
<br />
<br />
class Program <br />
{<br />
private void ImposeExpiryDate() <br />
{<br />
<br />
ExcelInterop.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass (); <br />
<br />
ExcelInterop.WorkbookClass workBook = (ExcelInterop.WorkbookClass)excel.Workbooks.Open( "c:\\test.xls", 0, true, 5, "" , "", true, ExcelInterop. XlPlatform .xlWindows, "\t", false, false , 0, true, 1, 0); <br />
ExcelInterop.Sheets sheets = workBook.Worksheets; <br />
<br />
DateTime dtExpirationDate = DateTime.Today.AddDays(2); <br />
try <br />
{<br />
workBook.Permission.Add(@"sachin@abc.com" ,Microsoft.Office.Core.MsoPermission.msoPermissionFullControl, dtExpirationDate); <br />
}<br />
<br />
catch (Exception EX) <br />
{<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
}<br />
Regards
Sachin
|
|
|
|
|
Please help me as I am getting 8-12 compiler errors & suck at C++. I just want to pass this class & teacher is a jerk with no help available. What's wrong with this? I will be eternally grateful.
//******************************************************
// Filename: D4_Lab_02.cpp
// Purpose: Fix the Errors
// Author: Melissa
// Revised: April 22, 2007
//******************************************************
#include<iostream>
#include<string>
using namespace std;
void pause(void);
#define PI=3.1415
int twiceage
string last_name;
string lastname_length;
string age;
//******************************************************
// main
//******************************************************
int main(void)
{
cout << "INPUT ITEMS\n";
cout << "\nEnter your last name ----->: ";
cin >> last_name;
cout << "\nEnter how many letters are in your last name --->: ";
cin >> lastname_length;
cout << "\nEnter your age ----------->: ";
cin << age;
cout << "\nOUTPUT ITEMS\n";
cout << "\nYou said your last name was: " << last_name;
cout << "\n\nYour last name has ";
cout << lastname_length<< " letters in it.";
cout << "\n\nYour age is: " << age;
twiceage = age*2
cout << "\n\nTwice your age is: " << age*2;
cout << "\n";
for (count=0; count <5; count++)
{
cout << "\nHi Mom!";
}
cout << "\n\nThe area of a circle with a 6 inch diameter is: ";
cout << 3 * 3 * PI;
pause(void);
return 0;
}
//******************************************************
// pause
//******************************************************
void pause(void)
{
char pause;
cout << "\n\n\nHit Enter Key to Continue: ";
cin.get(pause);
cin.get(pause);
return;
}
//******************************************************
// End of Program
//******************************************************
Melissa
|
|
|
|
|
1. What are the errors you're getting? It's hard to tell you the source if we don't know what they are
2. You have several syntactical errors:
a. int twiceage needs a semicolon after it.
b. cin << age; should have the pipe pointing the other direction
c. twiceage = age*2 needs a semicolon at the end
d. technically, you don't need arguments to the pause() function, and using pause(void) in the function definition is an error - if you're going to provide a type specifier you need to provide a variable name too (the declaration at the top is fine, though). So for pause, it'd be better just to declare the function as "void pause()"
Try fixing those and let us know what further errors you get.
------------
Cheers,
Patrick
|
|
|
|
|
Thank you, Patrick.
Now it's down to 8 errors, so that is a step in the right direction- yeah!
What it's saying is...
in function 'int main()'
43 no match for 'operator*' in 'age*2'
45 no match for 'operator*' in 'age*2'
48 overloaded function with no contextual type information
48 missing'>' to terminate the template argument list
48 could not convert 'count<5>' to 'bool'
48 no post-increment operator for type
55 expected primary-expression before '=' token
57 expected primary-expression before "void"
Also, could you explain how to arrive at the answer of 9 from this expression?
29 >= 25 ? 7 + 2 : 14 - 9
Wicked thanks a lot for any & all help!
Melissa
|
|
|
|