|
It's pretty frustrating just dealing with all of these options, none of which seem to be very concise.
Sorta makes sense that database programmers are among the best paid
Here's[^] another article I found, though you might find it's not too informative.
Good luck with your work!
|
|
|
|
|
Hello. I'm having a problem with focus. I'm developing an application with VS 2005 that is like the Outlook mail notification. I have a NotifyIcon and at a time a winform appear. The problem is that when I'm typing for example a word document and the alert appear I lost the focus to the alert and I can't continue typing my document. I call the window with frmForm.Show();
Thanks a lot !!!
|
|
|
|
|
After you show the alert, you must set the focus back to your form.
this.form1.Focus();
|
|
|
|
|
hi guys, is there anyway i can cast a string
like "System.UI.Button" to a Button?
thanks
|
|
|
|
|
You can create a type from a string with Type.GetType(typeName)[^], if that's what you mean.
Otherwise, since you can't exactly cast a type specifier into an instance, a little more info would be useful.
--
I've killed again, haven't I?
|
|
|
|
|
Activator.CreateInstance[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
if I have an array of 32 byte for example.
but there's only 8 slots used.
How can i count the number of slots used.
.length() or .getlength(0) only give me the total size of the array.
Thank ya'll
Donkaiser
|
|
|
|
|
Depending on what you fill into it there is probably no way. Better would probably be to use an ArrayList instead which handles this internally.
Other than that you could for example use Array.IndexOf(null) to find the first not assigned index. But this will only work if the type of the array is not a primitive type or structure.
|
|
|
|
|
try to create your own function... eg.
public int NumUsed(Byte[] arr)
{
int Ctr = 0;
for (int i = 0; i < arr.GetLength(0); i++)
{
try
{
Byte tmp = arr[i];
Ctr++;
}
}
}
although i'm not pretty sure that this will work... but you can try.
|
|
|
|
|
There are 2 problems with this approach
1) You cant have a try without a catch or finally.
2) Exception's should not control the flow of a program.
You are better off using an ArrayList or some type of collection, as they usually resize internally asnd provide a Count property.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
You are totally wrong. There are even more problems
3) the return statement is missing
4) even a call like NumUsed(new Byte[100]) (nothing set in the array - just initialized) will result in 100
|
|
|
|
|
that's why i said I'm not sure it'll work...
|
|
|
|
|
So now you can be sure it'll not work
|
|
|
|
|
why instead don't you try
won't it work???
public int NumUsed(object[] arr)
{
int Ctr = 0;
for (int i = 0; i < arr.GetLength(0); i++)
{
if( arr[i]!=null)
Ctr++;
}
return Ctr;
}
and when you set one array position to unused do it like
arr[i] = null
of course you would have to use an object array but you could cast the object to byte when you
the real value
i think it will do
NOthing by now;)
|
|
|
|
|
pq4noeh wrote: of course you would have to use an object array
But where the heck would then be any reason not to use an ArrayList?
|
|
|
|
|
Use a List<> and read the .Count value.
|
|
|
|
|
An array doesn't have a concept of unused items. When you create the array all the items are initialized to their default value, for bytes that is zero. So all items are initialized, used, and have valid values.
Either you have to define a special value that means that the item is unused, so that you can test each value, or you have to keep track of which items are used using another variable or array.
Or use a list instead.
---
b { font-weight: normal; }
|
|
|
|
|
Thx ya'll for the education.
Donkaiser
|
|
|
|
|
I use code:
byte[] arraybyte = System.IO.File.ReadAllBytes("app.exe"); Ok
System.AppDomain dom = System.AppDomain.CreateDomain("newDomain");
dom.Load(arraybyte); not work
do not start.
and use this code:
byte[] arraybyte = System.IO.File.ReadAllBytes("app.exe"); Ok
System.Reflection.Assembly.Load(arraybyte); not work
How it need work?
Help please.
|
|
|
|
|
Is app.exe a .NET exe? If not, you cant do that.
|
|
|
|
|
app.exe is a .NET .
I don't know how to do next step.
Application .Net do not start from byte[].
Please help me.
|
|
|
|
|
Is there a reason you couldn't just call System.Diagnostics.Process.Start() ?
|
|
|
|
|
Class System.Diagnostics.Process.Start() need String type
But my application in byte[].
I don't start my application from hard disk.
My application in memory.
|
|
|
|
|
byte[] arraybyte = System.IO.File.ReadAllBytes("app.exe");
System.AppDomain dom = System.AppDomain.CreateDomain("newDomain");
Assembly assembly = dom.Load(arraybyte);
assembly.EntryPoint.Invoke(null, null);
That calls the Main() method.
|
|
|
|
|
I run this code.
byte[] arraybyte = System.IO.File.ReadAllBytes("app.exe");
System.AppDomain dom = System.AppDomain.CreateDomain("newDomain");
Assembly assembly = dom.Load(arraybyte);
assembly.EntryPoint.Invoke(null, null);
But in line
assembly.EntryPoint.Invoke(null, null);
have runtimeerror:
"TargetInvocationException was unhandled
Exception has been thrown by the target of an invocation."
Please help me!
|
|
|
|