|
I need something like this:
private void LoadFieldsNames(string table_name)
{
string[] fields = new string[100];
switch (table_name)
{
case "step_result":
fields = {"ID", "UUT_RESULT", "STEP_PARENT", "LOOP_INDEX", "INTERACTIVE_EXENUM"};
break;
case "uut_result"
fields = {"ID", "STATION_ID", "BATCH_SERIAL_NUMBER", "TEST_SOCKET_INDEX",};
break;
}
comboBoxSelField.Items.AddRange(fields);
}
But i get an error. How can i manage the string propelly?
|
|
|
|
|
try this
private void LoadFieldsNames(string table_name)
{
string[] fields = null;
switch (table_name)
{
case "step_result":
fields = new string[]{"ID", "UUT_RESULT", "STEP_PARENT", "LOOP_INDEX", "INTERACTIVE_EXENUM"};
break;
case "uut_result"
fields = new string[]{"ID", "STATION_ID", "BATCH_SERIAL_NUMBER", "TEST_SOCKET_INDEX"};
break;
}
comboBoxSelField.Items.AddRange(fields);
}
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Thanks a lot - it works!
|
|
|
|
|
No problem
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Planning to use Microsoft Enterprise Library 5.0 for Data Access in an application.
Here Microsoft.Practices.EnterpriseLibrary.Data Namespace its saying content are outdated, but its latest library.
On many of methods same outdated message appears.
a) Is it OK to use this, Will class/methods works in future?
b) If its outdated then why MS promotes to use/follow patterns ?
c) Are their other alternative, like MS suggest in case of depreciated methods?
regards
|
|
|
|
|
I have a design related question. So please guide me on how to do this?
Right now, I have a xml structure which will be in this format.
<Sheet id="abc"/>
<Elements>
<Element id="xyz">
<value>23</value>
</Element>
<Element id="sdz">
<value>46</value>
</Element>
...
</Elements>
</Sheet>
So, we have a class like this to store each & every element of the sheet.
Sheet
{
Public string SheetId
{
get; set;
}
//all Elements will be stored in the below collection
Public IList<IDictionary<string, string>> Elements
{
get; set;
}
}
But now for few sheets the format has been changed to the below structure.
<abc> //SheetId
<Elements>
<Record>
<Element1/>
<Element2/>
<Element3/>
<Element4/>
</Record>
<Record>
<Element1/>
<Element2/>
<Element3/>
<Element4/>
</Record>
...
</abc>
So, we need to create a Generic class to hold the above xml formats and we don't want to have different object to store these.
I mean in future if we have some other xml format also we need to accommodate the same without any change in the Sheet class.
Ok. let me explain how my app works.
Actually we have around 200 sheets(in other words measures).
1) User will upload the sheet data in xml format (all sheets in xml file) & edit the same if they want Or Enter the data in the screen (dynamic screen generated using the xml template) if they dont want to upload.
2) Then the data will be stored in the Sheet object and it will go through lot of Validation process and finally the data will be converted to xml again and stored in the db.
You can ask why you want to store this as XML? The reason is we dont want to create 200 aspx pages for this same kind of data and thats why we are generating the sheet pages dynamically using the xml templates. Also, we will be adding, updating or deleting sheets frequently.
Ok. I think now you will have some idea about this issue.
To be more clear, all the elements in my XML file will be displayed as a field in the aspx page. It maybe a Textbox, dropdown & etc....
So, can anyone please advise me on how to design the Sheet Class.?
|
|
|
|
|
Since the goal should be to handle all of the files the same way, you could:
0) Write some code to import/convert the old files to the new format.
1) Write some code to handle the difference, but in the end create the same objects regardless of incoming format.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
You have a 'design' problem not a "class design" problem.
Right now your architecture looks like the following.
xml/objects => business functionality.
The problem with that is that you now want to coerce all possible models into something that is difficult now and possibly impossible in the future.
Your architecture should look like the following.
xml => transform/map => business objects => business functionality.
If it did then all you would need to do would be to add another 'transform/map' for each new form that the xml takes.
|
|
|
|
|
I am working on a project, as the beginning, my program must allow user to draw 2D shapes ( like windows paint or (more professional) 3dsmax ).
I try drawing a grid by calling a function from form' load event. (its not working well , it draw sometimes and sometimes not !! )
I try using mouse_move, mouse_down, mouse_click events of my form to call proper functions for drawing user specified shapes. ( its not working well either. )
because I will have a lot of shapes, I could not use the onPaint event and put all my drawing codes there , cos it will result in screen blanking and I am not satisfied with that.
So, for example one of my main problems with my specified method is this :
I use click-and-move method for drawing shapes, Does anyone knows how I can use this method more effective ?
Or is there any way to do this more fast and reliable ?
|
|
|
|
|
The one correct way is by putting all the painting code in the Paint handler. Here[^] is an article giving theory and an example.
You should describe your drawing elements in some data structures; there are lots of examples around, look for CP articles that have "Paint" in their title, or Google for "Paint.NET".
|
|
|
|
|
You *SHOULD* use WPF. WPF is very conducive to what you want to do. In fact, it will do 90%+ of what you have described out of the box with almost no effort from you. If you do not use WPF, well, you are going to be writing a lot of code yourself thats already been written by the WPF team .
|
|
|
|
|
well , I used WPF for one of my projects before, you are right it has a lot of advantages which are geart !!
But for this project, WPF MAY seem to be useful for GUI part, but for AI part of my project WPF is weak, or better say its so hard to do what I want in WPF.
|
|
|
|
|
That makes absolutely no sense. If WPF makes fully half of your job easier, WPF is probably the way to go. I have a feeling that down deep, you know this to be true, but you're fighting it. That's not going to do anything but hold up the project and pissing off everyone involved.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Huh? When you use WPF for the GUI portion, you still use C#. Heck, you can even break out your "AI" into a seperate assembly and use whatever language you want.
|
|
|
|
|
you'r right, I like to use WPF too, but I have already written a lot of codes in C# and considering that I have just one experience of working with WPF, it will take a long time to migrate.
Now you mean C# itself is useless for drawing ?
I want to do a reasoning from shapes, so the most important part is not drawing the shapes, its working with shapes. such as moving a rectangle on to an other rectangle and saying that which of is greater (pictorially), by the way I am open to hear any ideas for doing reasoning.
|
|
|
|
|
Remember, in GDI/GDI+, you draw on a FLATTENED surface. You lose all context of what you just drew. Lets say you draw 2 squares in GDI/GDI+... as soon as you draw them, as far as the drawing surface is concerned, they are now just a bunch of random pixels. You have to implement all the hit testing, z-order, mouse tracking, position, size, etc. In WPF, the surface is layered for you already and all shapes are objects. So everything I just listed (hit testing, z-order, mouse tracking, position, size, etc.) is free for you out of the box.
Another scenario... lets say you have a bunch of shapes and want to move one. In GDI/GDI+, you'd have to know which part of the screen to redraw, double buffer it and update the position of the new shape. In WPF, you just type "rect.Left += 10;" and you are done. WPF knows what it has to redraw, the double buffering is done for you, etc.
To implement a full featured drawing surface without WPF is a ton of work. To implement the same thing in WPF is a fraction of the work since most of it is done for you already and it will perform better since WPF is hardware accelerated where GDI/GDI+ is not. GDI/GDI+ is all software rendering.
|
|
|
|
|
dear SledgeHammer01 thanks for your support,
I store all essential info of a drawn shape in an ArrayList so that I can move or rotate or do what ever I need to not so hard, but this does not mean that I don't agree the with you with the great benefits of WPF.
I will discuss with my advisor so I may change to WPF.
but I need to know, for reasoning part (which I discussed before) which one is more RELIABLE and Easy-to-Use ? (C#/WPF)
since I have a lot experience of working with AI algorithms in C# and I don't have any such experience in WPF
|
|
|
|
|
Rotation is done for you too .
Me personally, since WPF does so much for you, I'd say its definitely easier. I don't think you have the kind of QA WPF has had, so I'll say WPF will be more reliable then you implementing all that code yourself.
Hey, whatever you want . I still don't see how AI fits into the GUI portion. That seems like implementation details for the back end.
|
|
|
|
|
I trying to say (for example) Rectangle1 is going to fit in Rectangle2 without using the dimensions or Height and Width. I need help in this field too, programmatically how its possible in you ideas ?
|
|
|
|
|
Hi All,
Thank you in advance for reading this, I appreciate your time.
I got a .Net 3.5 application running perfectly on Win7 - 64 and 32 bit.
Also works fine on win XP - 32bit , Didn't try it on XP 64 platform though.
The problem starts on Vista machines.
At first it didnt open at all - DEP error.
I disabled DEP (Post-build event for both obj folder app.exe and bin/Release app.exe)
Checking the .msi deploy (It has to be a deploy eventually - being a commercial product),
on Vista behaved bit better this time but was froze again after a while.
Trying to add the App.exe (after disabled DEP) to the exception list of Vista DEP raised the following:
"This program must run with Data Execution Protection (DEP) enabled.
You cannot turn off DEP for this program."
??
Needless to say I am bit stuck here.
This is for commercial use and I need it to be compatible for all platforms.
A few words of what is included in my project, that I can share:
a. Video runs from start - I use wmp control (ActiveX control).
b. got a keyboard mapped by the InputSimulator.dll[^]
c. got a code using user32.dll to hook some keyboard combinations
I am working on win7-64bit visual studio 2010 C#, FW3.5
My questions:
a. How do I know DEP is really disabled?
- any way to check the .exe for that DEP disabled on my platform?
b. Do you think wmp is causing this or the other .dll's?
Any Suggestions would be appreciated
Thank you again for reading,
Shabi
modified on Tuesday, September 20, 2011 1:25 PM
|
|
|
|
|
If you have to disable DEP to make your app run, you need to re-evaluate the way your app is written. You have much bigger problems.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Turns out it runs perfectly on other Vista machines..
Bad luck on that specific machine I have tested.
Thanks for the reply though,
Shabi
|
|
|
|
|
In Windows Task Manager, open the processes tab. In the view menu, go to select columns. Select "data execution protection".
Have you checked that the remaining problems are not actually caused by UAC?
|
|
|
|
|
Greetings gurus,
I would appreciate your input on whether this idea is even workable before getting to complicated.
The goal:-
Retrieve performance data from remote PC A on Domain A into a SQL database on PC B on Domain B via a running service on PC A.
The method:-
Create a program in C# or C++ which retrieves CPU usage, Available RAM, disk usage and uploads the metrics to a SQL database. This program will run on a target PC as a service/agent.
Note:-
I have already created something similar in vba which runs under MS Access in the LAN but I would like to extend this concept.
I have tried getting Windows Performance Monitor (perfmon) to upload to a remote SQL db but have found that perfmon can't pass on the SQL login (i.e. the connection tests ok but writing to the table fails)
So:-
I have found this Simple Windows Service Sample[^] and used it to create a service. Could someone please point me in the right direction where I can learn (by example) how to read the above metrics?
I have tried to understand some examples of reading hkey_performance_data without getting the code right and I would prefer not to use WMI queries as they seem to slow the host machine down while querying the WMI base.
Any suggestions please.
Many thanks.
|
|
|
|
|
I suggest a WebService running on PC B and the Windows Service on PC A can access it to store its data.
|
|
|
|
|