|
Screen capture and OCR?
|
|
|
|
|
5 for that.
Simon
|
|
|
|
|
I have the following VB.net codes:
<br />
da = New OleDbDataAdapter(strSQL, dbConn)<br />
dt = New DataTable<br />
da.Fill(dt)<br />
<br />
Dim rows As DataRow<br />
cnt = dt.Rows.Count()<br />
<br />
If cnt > 0 Then<br />
For Each rows In dt.Rows<br />
Total += rows.Item("Total")<br />
Next<br />
End If<br />
I changed to these C#:
<br />
da = new OleDbDataAdapter(strSQL, CGlobal.dbConn);<br />
dt = new DataTable();<br />
da.Fill(dt);<br />
<br />
cnt = dt.Rows.Count;<br />
<br />
DataRow rows = default(DataRow); <br />
<br />
if (cnt > 0)<br />
{<br />
foreach (rows in dt.Rows) <br />
Total += rows.Item("Total"); <br />
}<br />
And I have the error in in above, can anyone help to correct my C#?
Thank
|
|
|
|
|
When you use a foreach, you need to say what the type is; hence foreach (DataRow rows in dt.Rows) .
|
|
|
|
|
I did try before & had 2 errors:
<br />
cnt = dt.Rows.Count;<br />
DataRow rows = default(DataRow); <br />
<br />
foreach (DataRow rows in dt.Rows)<br />
Total += rows.Item("Total"); <br />
By any chance you know how to fix them? What I need to get values from column 'Total' of those selected row
Thanks
|
|
|
|
|
rows is already defined in the line above the foreach.
Why not use row seing as it will represent just one row.
foreach (DataRow row in dt.Rows)
Total += row.Item("Total");
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I did try & have small error from Item, but I think I can fix it by using array for the column.
Thanks,
|
|
|
|
|
Item is an indexed property, so you use
Total += rows.Item["Total"]; C# uses square brackets [ and ] for indexers.
|
|
|
|
|
ATC wrote: have the error in in above
Be more descriptive
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
da = new OleDbDataAdapter(strSQL, dbConn);
dt = new DataTable();
da.Fill(dt);
DataRow rows = null;
cnt = dt.Rows.Count();
if (cnt > 0)
{
foreach (DataRow rowsWithinLoop in dt.Rows)
{
rows = rowsWithinLoop;
Total += rowsWithinLoop["Total"];
}
}
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
Hello all,
In the solution i am working there are more than 1000 forms and we are planning to enhance all forms' Layouts to support localization, like resizing labels and moving associated controls using TableLayout panel control. Doing manually is tedious and time consuming process.
Any thoughts of how to enhance UI layout to use TableLayout programmatically? (I guess Programmatically little difficult to decide how may rows or columns to create? which controls to be spanned?
Any ideas?)
Thanks
|
|
|
|
|
Member 2324483 wrote: we are planning to enhance all forms' Layouts to support localization,
Shouldn't that have been a basic requirement at the start of this app??
Member 2324483 wrote: Any thoughts of how to enhance UI layout to use TableLayout programmatically?
Have fun with that. You might be able to do it in code, but not easily. It'll require some kind of analysis engine to determine the converted layout. And, as with any automated conversion process, there's going to be things the engine just can't figure out properly. Form layout's are going to get trashed one way or another.
I don't know the size of your team, but it better be big, because either way, you've got a near total rewrite of your UI on your hands and LOTS of testing to do.
|
|
|
|
|
thanks for the reply.
I agree with you that it should be a basic requirement. But the solution, which i am working on, is upgraded from VS 2003 to 2005 to 2008. so, no tablelayoutpanel in 2003. Now planning to localize the app.
|
|
|
|
|
I hope you get paid by the hour!
|
|
|
|
|
|
Nope. There's just no easy way to do this. You've got about a thousand forms to go through. Even if you had an automated way to do it, you'd still be going through a thousand forms to check the automated processes work.
|
|
|
|
|
I have a Reference Question. I am faily new to C# so this might be a very basic question. I have my references folder in my project. I can add and delete them as needed. But I am trying to add two references that have the same name but different version numbers. But I need both because the both do something different for me. Is there a way to add a reference that is the same name and type but a different version number?
What I am trying to do is connect to a COM server. The Reference is to the COM type library so that I can access it and get all of the data out of it. The problem being is I am supposed to support two versions of the same server. When I try to add the reference it states that the type library already exists. When I add the reference I add it from the location on my C drive and it adds it to my project. Is there a way not to add it to my project, but point to it with a path and take whatever reference I need whenever I need it and not have it part of my project?
|
|
|
|
|
The problem you're looking at is those two libraries are using the same GUIDS, so, there's no way for Visual Studio to tell the difference between the two. You're only option is to use all late-binding methods to use these libraries, but that's going to be VERY painful to write. You won't have any Intellisense support at all. It'll be like writing code in Notepad.
|
|
|
|
|
What exactly is a late-binding method? How would I set it up so that I can use these methods? Are there any examples out there?
|
|
|
|
|
Late Binding is, when your code runs, the objects and methods are not exactly known before hand. You ahve to create the objects, then manipulate them using methods that lookup and execute the object's methods and properties, kind of like this[^].
The problem with the example listed is that it won't work with your problem because in order to create the object "Excel.Application", the COM component must be registered. Since your two component most like have the same names, you can't register them both. Or can you?? You'll have to investigate this yourself since we know nothing of your components.
I seem to remember a brief foray into registrationless-COM a few years back, but I haven't heard anything about it since. This involves writing managed C# custom wrappers around the COM components, but documentation and tools on the technique are just about impossible to come by now-a-days, so I think this is a dead end.
|
|
|
|
|
Here is the code.
object padobj = System.Runtime.InteropServices.Marshal.GetActiveObject("PowerPCB.Application");
padsApp = (PowerPCB.Application)padobj;
View.Doc.padsDoc = padsApp.ActiveDocument;
View.Doc.padsDoc.SelectionChange += new PowerPCB._PowerPCBDocEvents_SelectionChangeEventHandler(eeSelection);
padsApp.UnlockServer();
If you notice I am setting padsApp to the the object. But I have to cast the object to PowerPCB.Application. The problem that I am running into is the PowerPCB reference has two versions. I have no problem connecting to the loaded PowerPCB reference, but when I try to connect to the other version I crash when I try to use the padsApp object because I am not using the correct version of the PowerPCB reference. But if I change out the reference and restart the program I am able to connect to the other version just fine. So basically there is no way to point to a reference in a specific location and use that specific reference? It has to be loaded into my project?
|
|
|
|
|
SRogers88 wrote: I have no problem connecting to the loaded PowerPCB reference, but when I try to connect to the other version I crash when I try to use the padsApp object because I am not using the correct version of the PowerPCB reference
You can't do it this way. You're going to have to create two seperate wrapper projects. The first is going to have to reference the first version of this COM server and the second is going to have to reference the second version. You need to set references to the .DLL files themselves and not to what you find under the COM tab in the Add Reference dialog box. You're then going to need to re-expose the classes, properties, methods, and events you want to use for each version of the servers, as appropriate.
Then, when you get both servers wrapped, you'll add references to both of your wrapper projects and use those COM servers through the wrappers. There is no guarantee this is going to work though. You're going tohave to experiment with this yourself to find out.
|
|
|
|
|
I was asked this recently, and I'm not even sure if I understood it correctly. Hope someone can understand / explain what was asked and hopefully try to answer the question:
Let's say I use someone else's unmanaged code. I cannot see that code. Is there anything I can do after calling this unsafe code to make sure that the managed code did not leak memory?
|
|
|
|
|
No, not reliably. You simply have to trust it. If you use the library as documented, you have to trust that it's managing it's resources properly.
|
|
|
|
|
Hi,
I work with RS232 printers and sometimes they have just a few changes in the serialport configuration, like one has Parity=Even and other has Parity=None, or sometimes in the baudrate.
My questions are:
1) Does SerialPort has any builtin function that could read this configuration, without me changing it manually (I can change the port name manually of course)
2) If not, does anyone have ever implemented such feature? What would be a nice (and safe) approach for that?
Thanks,
Dirso
|
|
|
|