|
how about Maincharacter = null
« Superman »
|
|
|
|
|
Good Day;
Does any one know a way to Reset/Change Passwords on mainframes?
Help will be appreciated;
Thanks;
|
|
|
|
|
What flavor of mainframe?
|
|
|
|
|
i wonder if there is a way to write a function using win32 API or .NET to automatically shut down windows xp when called.Then i can put the function in the comsumer application in WMI using the Start method to listen to the provider application which fires the event since the
System.Management provides the wrapper for WMI.
i am just curious about such an interesting problem.
welcome any advice
|
|
|
|
|
|
When implementing the IDisposable interface it is possible to use a class like this:
using ( MyClass myClass = new MyClass() )
{
...
} But it is also possible to use it without the using statement:
MyClass myClass = new MyClass();
... Question:
Is it possible to "force" a user of a class to always include it inside a using statement? (Maybe e.g. by applying some kind of attribute to that class)
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
AFAIK it isn't possible without some sort of code injecting/inspecting tool.
FXCop might have something like this already built in. And I know there is a free tool out there now for post compilation code injection, but I cannot remember the name of it now.
Beyond that, you could cheat the system a little bit and throw an exception from the Finalizer; just make sure your Dispose method calls GC.SuppressFinalize . If the Dispose method is never called on your object the exception thrown from the finalizer would alert them at some point in time about it..You would only want to do this in a debug build and probably need to capture a stack trace in the constructor so your exception thrown during Finalize can pin-point which object is causing the exception.
James
|
|
|
|
|
Great tip! Thank you, James!
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
Uwe Keim wrote:
Great tip! Thank you, James!
They don't call him Mister .NET for nothing!
Nish
|
|
|
|
|
Oh, I was unaware of that. BTW: Where is Heath?
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
Uwe Keim wrote:
Oh, I was unaware of that.
http://www.misterdotnet.com/blog[^]
Uwe Keim wrote:
BTW: Where is Heath?
Since he got Microsofted, he's been irregular in his posts
|
|
|
|
|
That reminds of a cute trick I learnt in C++. It is used to prevent people from mistakenly ignoring the return value of a function. Basically, it is a template class that has an implicit conversion to the actual return value of the function.
Off the top of my head,
template <typename T>
class Wrapper
{
T val;
bool used;
public:
Wrapper(const T &_val) : val(_val), used(false)
{
}
Wrapper(const Wrapper &w)
{
val = w.val;
w.used = true;
}
operator T()
{
used = true;
return val;
}
~Wrapper()
{
if (!used)
{
throw std::string("You forgot to use the return value");
}
}
};
Wrapper<bool> someFunc()
{
return false;
}
So bool v = someFunc(); will run smoothly, whereas someFunc(); will throw an exception.
Interesting use of destructors!
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I am having a problem converting an object. I am new to C# with a C++ background. I modified some sample code to gain some experience with classes and the associative array. My goal is to create my custom class and use the associative array to house instances of that class. Most examples show how to view the data with the console.writeline method (works for me also), but I would like to place the information in a local field at the main level.
I can store various instances into the array and view them in the debugger, but I cannot access them through main as show below. I get the following error message: Cannot implicitly convert type 'object' to 'ConsoleApplication4.Checks.
I would really appreciate some help.
Thanks,
public class Checks;
{
public Checks(int RegisterID, int CatID);
{
:
:
}
}
public class Register
{
public Register(int size)
{
:
:
}
public object this[int RegisterID, int CatID]
{
get
{
string key = Convert.ToString(RegisterID);
key += Convert.ToString(CatID);
return KeyToObject(key);
}
set
{
:
:
}
}
protected object KeyToObject(string key)
{
for(int n = 0; n < _count; ++n)
{
Checks trankey = (Checks)_items[n];
if(key == trankey.key)
return trankey;
}
return null;
}
}
class Class1
{
static void Main(string[] args)
{
Register Pay = new Register (1);
Checks temp = new Checks (5,3);
temp.Description = "Vons";
temp.Amount = 30.50m;
Register [5,3]= temp;
temp = new Checks(6,2);
temp.Description = "Home Depot";
temp.Amount = 126.75m;
Register [6,2]= temp;
temp = Register [5,3];
}
}
cab3
|
|
|
|
|
Have you tried casting?
temp = (Checks) Register [5,3]
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Dah, I must have been moving too fast. Thanks a lot, and yes that solved it.
cab3
|
|
|
|
|
Thanks for the help.The problem is that i am desinging my
own harware stereo fm radio which has a usb connector
which is plug into the usb port of the system,whether
i write driver for this particular device or dll for
using it in c#.Net and control it?.kindly tell me the
proper solution for the above query.waitng for your reply....
@hs@n
|
|
|
|
|
Hi,
Bit of a coincidence, I was just checking out usb stuff
at http://www.icsharpcode.com
check it out might be useful.
HTH
Web design and hosting
http://www.kayess.com.au
|
|
|
|
|
Thanks for your attention.
Currently I am working on a image processing program for PPC (using C#), yet there are two problems remained to be solved:
1. Rotating an image. Compact framework doesn't support the methods such as "Image.RotateFlip" or "Graphics.DrawImage(Image, Point[])", so I need to implement the rotation function completely by manually coding. Therefore I need an algorithm, which doesn't invoke any special system-provided method, to perform image rotation.
2. Saving an image. The compact framework doesn't support the Image.Save method, so I have to find another way to save a Bitmap object into a JPEG file.
Any kind of help will be greatly appreciated. Thanks.
|
|
|
|
|
Answering your first question
There are some image processing libraries on CodeProject, try to look at their sources.
You can try to research CxImage [^], there is an implementation of image rotation. Or you can try this one [^], written on C#.
|
|
|
|
|
Hi,
I am trying to grab a video clip from a movie in C# using DirectShow. I am using DirectShowNet project which I got from codeproject.com.It is working well when i am using devices like web cam etc .
I am getting problem in playing a movie which is stored on hard disk and capturing video clip from it.
An Exception is raised when SetupGraph() function is invoked from
RenderStream() function "Invalid Parameter".
I had used FilterCategory.LegacyAmFilterCategory as first argument to
DsDev.GetDevicesOfCat() function.And from the list of devices displayed by DeviceSelector class I am selecting 'File Source(async)'
|
|
|
|
|
Hi guys and gals,
I have a windows form with a DateTimePicker and a DataGrid. What I would
like to do is double-click a cell in the DataGrid and have that cell
update to show the date that is selected by the DateTimePicker.
Any suggestions as to how I could do this?
TIA
Steve
Web design and hosting
http://www.kayess.com.au
|
|
|
|
|
Perhaps you could even embed the DateTimePicker in the DataColumn, so that whenever you click on a cell it drops down so that you can select a date and automatically updates itself. Have a look here[^].
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks Polis, but that's not what the boss wants I'm afraid.
Web design and hosting
http://www.kayess.com.au
|
|
|
|
|
In that case, here's what I think.
1. First of all, in order for you to be able to handle the cell you click you have to get the current row by writing something like:
CurrencyManager <code>xCM</code>= (CurrencyManager)this.dataGrid2.BindingContext[this.dataGrid2.DataSource, this.dataGrid2.DataMember];
DataRowView <code>xDRV</code>= (DataRowView)xCM.Current;
DataRow <code>currRow</code>= xDRV.Row;
2. Then you move on by specifying that you wish to respond only to mouse-clicks that fall between a cell's range:
System.Drawing.Point <code>point</code>= new Point(e.X, e.Y);
DataGrid.HitTestInfo <code>info</code>= this.dataGrid2.HitTest(point);
if(info.Type == DataGrid.HitTestType.Cell)
{
currRow[myDataTable.Columns["Date"]] = this.dateTimePicker1.Value.ToShortDateString();
}
A piece of note here. In order to be able to get the your new point from e.X and e.Y, you will have to write the code in a relevant event (such as your dataGrid's mouseUp event)
Something important: The actual change will not take part on the dataGrid itself but on the DataRow of the table that the dataGrid is bound to. By changing the column of your bound table, the value on the dataGrid's cell will automatically change
Hope this pleases the boss
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank you Polis,
you are my hero
now if I do a
if(e.Clicks == 2)
in the MouseUp Event that will handle the
double-click.
Cheers
Steve
Web design and hosting
http://www.kayess.com.au
|
|
|
|