|
yes, and i found
object selectUsingUI = System.Reflection.Missing.Value;
wiaRoot = (ItemClass) wiaManager.Create( ref selectUsingUI );
if( wiaRoot == null )
return;
wiaPics = wiaRoot.GetItemsFromUI( WiaFlag.SingleImage, WiaIntent.ImageTypeColor ) as CollectionClass;
can please explane what happen by this code.....
i can access the webcam. i want to show output in a picturebox now. later capture image.
A S E L A
|
|
|
|
|
can't i use picturebox to camera capture other than using WIA dialog to show....???
A S E L A
|
|
|
|
|
|
How to create the winform with code not by the guide (project-->add-->windows Form) at desgin-time in c#? and how to add some button in the dynamic created winform?
Many thanks
|
|
|
|
|
I would recommend the Petzold book on Winforms, he creates everything in code. To add a button to a form, you create it, and add it to the controls collection of the form. Then you tell it where it sits ( x,y,width,height)
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thank Christian Graus, Could you please tell me the full name of the book ? and in which place I can order it.
|
|
|
|
|
Charles Petzold - Programming Microsoft Windows with C#. Amazon will have it.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
How do I use a field storing Type information?
private Type _DataType;
private Dictionary<int, object> _BlobData;
...
_DataType cow = (_DataType)_BlobData[0];
Is "Type" not the right type?
|
|
|
|
|
Generics is how you do stuff like that.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
redivider, to get data out of the dictionary you have to give it the key. In a dictionary, the key is the first type whatever that is. So since you are using an int, then the integer value that you entered must exist in your dictionary, else it will be null.
For a list, this is completely different from a dictionary, and you can just sellect the first field or [0].
int key = 39292;
String testObj = "Hello I'm a string";
object value = (object)testObj;
so in your example... _BlobData.add(key, value);
To get out the value... you have to put in the correct key...
String myOldDefinition = (String)_BlobData[key];
Console.Writeln("My old string = " + myOldDefinition);
HTH,
Marc
Life is too short to program in Visual Basic.
|
|
|
|
|
redivider wrote: Is "Type" not the right type?
It is, but you are casting to _DataType , which is a variable, not a data type. Seems that you are confusing the two concepts of data type and variable (i.e. an instance of a data type). Besides that, the Object.GetType() method is the way to get type information from an object, casting will generally not work.
So your code snippet should read something like this:
private System.Type _Cow;
private Dictionary<int, object> _BlobData;
...
_Cow = _BlobData[0].GetType();
Regards
Thomas
www.thomas-weller.de
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. Programmer - an organism that turns coffee into software.
|
|
|
|
|
When i have
int i = 10;<br />
i = 5 * i;
it knows i'm not trying to multiply 5 * i, but rather 5* the value stored in i.
So i'm not trying to cast to a variable (_DataType), but rather the value stored in that variable (int, float, string)...
How would generics come into play?
|
|
|
|
|
Hey I'm looking for a bit of help for a generic letter (see code below) Generator.
The funciton takes a number and returns a String.
expected:
input output
----- ------
1 a
26 z
27 aa
28 ab
52 az
53 ba
54 bb
78 bz
79 ca
702 aaa
703 aab
704 aac
...
Here is the code I got so far:
public String getLetter(int? number)
{
number -= 1;
String letter = "";
char[] lettersA = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
};
int size = number.Value % 26;
int bigSize = number.Value % 676;
int loop = (int)Math.Floor((decimal)(number.Value / 26));
int bigLoop = (int)Math.Floor((decimal)(number.Value / 676));
for (int i = 0; i < loop; i++)
{
letter += lettersA[i];
}
letter += lettersA[size];
return letter;
}
Please respond if you have a solution.
Thank you,
Marc
Life is too short to program in Visual Basic.
|
|
|
|
|
Why take an int? What happens if you get null passed in ? You don't check for it.
What is going wrong right now ? It's hard to 'find a solution' if you don't tell us what the problem is. I can see why this probably can never work, your for loop can't possibly return any thing but a, ab, abc, etc. I would expect to use a while loop and a stringbuilder to build a string based on the values I kept subtracting from the core number until I got to 0.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
ok I'll try and add a StringBuilder to this. I spent a day on it and the solution was not cliquing. I think I'll just get out an algorithms book and start from square one.
Thanks,
Marc
Life is too short to program in Visual Basic.
|
|
|
|
|
I think your best bet is to set a breakpoint and step through and see what your code is doing, so you can see where it's deviating from your intentions.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I have a .dll with its own config file. This .dll reads from its own config file and not from the app.config (this is what I wanted). However, when I create the installer for the application, the .exe uses the app.config file to read from, but what about the .dll? Where is the config file for the .dll stored? It is getting the values but I am curious where it is getting it from? The app is working fine but I want to change the config file for the .dll but I cannot find it.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Have you looked for the settings in the apps config file ? If you don't have a config file for the dll ( I always do ), then it's either using defaults, or getting them from the app config.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
CodingYoshi wrote: I have a .dll with its own config file.
No you don't. .DLL's do not use their own config file, even if you put on in the DLL's project. .DLL's are loaded into the processes that call them, inheriting the host process' config file, if there is one.
Your code has to be explicitly written to find and load the config file your talking about. Config files are normally stored in the same folder as the .EXE using it.
|
|
|
|
|
Strange!! Then it should cause an exception since config setting are key value pairs. I have specified the key of the value in .dll code. The only other thing is, tomorrow, I have to reassure and see if a value with the same key exists in the app.config which will explain why no exception is thrown. Otherwise, I don't know.
I agree with you, .dlls can have their own config files but they have to be read explicitly and I am reading it explicitly but I will reassure.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
I reassured and the .dll is using its own config file. I am using [NameOfDll].Properties.Settings.Default.[keyOfValue] to access the value from the config file. I changed the config file for the .dll and during runtime it threw exception since it could not find it.
So the question is, where is it reading from? I don't see a config file for the .dll on the production machine but all is fine.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
In my code, I use a static method of a class. For example, class name is ABC. The static method name is GetService().
I called the ABC.GetService() twice. The first time it returns null, because the ABC service is not available at that time.
However when I call the method the second time, it should return the service, because the service is available already. but the code still retunrs null. If I put a break point before the second time I call the function. I can use code to see the ABC.GetService() returns the service.
It seems to me that the code remember the previous result and used it again when it should not.
Is there a way to resolve this issue.
Any suggestions are greatly appreicated.
Best Regards
Bin
|
|
|
|
|
I suspect your code is broken. The best way to write code like this, is to make your static property check if the return value is null, and if it is, try to populate it, before returning it. Obviously, if you want us to tell us what's wrong with your code, you need to post it.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thank you very much for your reply.
The first time when the function is called. The value is supposed to be null. I don't want to populate the value at that time.
I cannot post the code here. It is a very big project. The service is SharePoint shared service. In the beginning, the service is not available. I ran psconfig.exe to create the shared service. I will try to repro this with some simple example.
Thank you very much
Bin
|
|
|
|
|
You can't post the code to a property ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|