|
I have been hearing years can I convert from xxx to C, C++, and now C#. Now the issue at hand, a VB .NET application to be converted to C#. My initial inclination is to address the question of what is gained by converting to C#? Don't get me wrong, I prefer any C variant to any VB variant. BUT with .NET the choice of language is really distilled down to what style you prefer most: C#, VB, J#, I even hear there is a Python for .NET. At the end of the day, unless you have a lot of spare time converting an application to another for the sake of changing styles and format is a dubious endeavor. IF however you have a real need such as your company has forbidden VB then I would lean toward rewriting. Code generators and converters are decent when you get then tuned but let's face it if the whole point of converting the app is to get it in C#, I would not trust that to a conversion process.
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
I have been hearing years can I convert from xxx to C, C++, and now C#. Now the issue at hand, a VB .NET application to be converted to C#. My initial inclination is to address the question of what is gained by converting to C#? Don't get me wrong, I prefer any C variant to any VB variant. BUT with .NET the choice of language is really distilled down to what style you prefer most: C#, VB, J#, I even hear there is a Python for .NET. At the end of the day, unless you have a lot of spare time converting an application to another for the sake of changing styles and format this becomes a dubious endeavor. IF however you have a real world need such as your company has forbidden VB then I would definitely lean toward rewriting. Code generators and converters are decent when you get then tuned but let's face it if the whole point of converting the app is to get it in C# to improve the maintainability, I would not trust that to a conversion process.
Good Luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
There are a number of VB to C# converters out there, including ours (Instant C#). The code quality after conversion will be nearly identical to the code quality before conversion (after a few manual adjustments).
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
|
Hi all
i can set the region of the tab control, and also i can set the region of the tabpage to any shape i want
but i am wondering how to set the region of the Tabs itself
if u can help, plz show me the way , or give me a suitable URL
thx
|
|
|
|
|
I have created a class to hold some related data (ResultsOfTest). I am reading a record from an Access file, loading the data into the members of the ResultsOfTest class, then inserting into a database.
This works properly, except I am consuming massive amounts of memory. My understanding was the memory would be released when the new'ed object went out of scope (which should be at the end of the while loop). This doesn't seem to be the case, so I stuck in a garbage collection collect call every 1000 iterations. This doesn't seem to have any effect on the memory consumption.
while (readerAccess.Read())
{
ResultsOfTest testResult = new ResultsOfTest();
try
{
if (!readerAccess.IsDBNull(iTestIndex)) { testResult.TestID = Convert.ToDecimal(readerAccess.GetInt32(iTestIndex)); }
if (!readerAccess.IsDBNull(iEmployeeIndex)) { testResult.EmployeeID = Convert.ToDecimal(readerAccess.GetInt32(iEmployeeIndex)); }
if (!readerAccess.IsDBNull(iTestDateIndex)) { testResult.DateOfTest = readerAccess.GetDateTime(iTestDateIndex); }
if (!readerAccess.IsDBNull(iReasonIndex)) { testResult.ReasonForTest = Convert.ToDecimal(readerAccess.GetInt32(iReasonIndex)); }
if (!readerAccess.IsDBNull(iDeferredDateIndex)) { testResult.DeferredDate = readerAccess.GetDateTime(iDeferredDateIndex); }
if (!readerAccess.IsDBNull(iReadDateIndex)) { testResult.ReadDate = readerAccess.GetDateTime(iReadDateIndex); }
if (!readerAccess.IsDBNull(iResultIndex)) { testResult.TestResultCode = Convert.ToDecimal(readerAccess.GetInt32(iResultIndex)); }
if (!readerAccess.IsDBNull(iCommentIndex)) { testResult.Comments = readerAccess.GetString(iCommentIndex); }
iRecordsRead++;
}
catch (OleDbException odex)
{
logger.Error("Unable to read record from Access db. {0}", odex.ToString());
}
if (testResult.TestID > 0)
{
if (db.UpdateTestResults(ref testResult))
{
iRecordsWritten++;
}
}
if ((iRecordsRead % 1000) == 0)
{
StatusScreen.SetStatus("Garbage collection in process...");
GC.Collect();
}
}
What can/should I do differently, so the program will release the un-needed memory?
Thanks,
Glenn
-- modified at 10:57 Wednesday 15th March, 2006 (placed pre inside the code marker)
|
|
|
|
|
Glenn E. Lanier II wrote: My understanding was the memory would be released when the new'ed object went out of scope (which should be at the end of the while loop). This doesn't seem to be the case, so I stuck in a garbage collection collect call every 1000 iterations. This doesn't seem to have any effect on the memory consumption.
Garbage collection occurs when it needs to. When objects go out of scope they mearly become available for garbage collection.
If you are looking at the memory in the Task Manager then it will be showing the amount it has reserved from the operating system, not the actual amount in use. There are a number of performance counters you can look at for .NET applications. They will give you a more accurate picture of what is going on.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Colin Angus Mackay wrote: If you are looking at the memory in the Task Manager then it will be showing the amount it has reserved from the operating system, not the actual amount in use. There are a number of performance counters you can look at for .NET applications. They will give you a more accurate picture of what is going on.
Such as?
I let this code run yesterday (without the GC.Collect()) on about 60000 records. I logged each update, and noticed that while I was getting > 1 insert/second initially, by record 20000 insert time was reduced (as was machine response time) and by the time I got to record 32000, I was getting an insert every two-three minutes. Task Manager showed this process was using ~485M of memory. As soon as I killed the process, memory usage (again, using task manager) dropped almost immediately. I started the import again (skipping the already imported records), and I saw similiar results.
I'm open to any suggestion(s) that will allow this code to run efficiently.
--G
|
|
|
|
|
When you're done using the SqlDataReader, call Dispose() on it. This will release some unmanaged resources and may also allow some managed objects to eventually be freed. The same goes for your SqlCommand and your SqlConnection.
Another thing might be your call to db.UpdateTestResults(ref testResult). If you're storing your testResult somewhere, it won't be freed, obviously. So perhaps your large consumption of memory is due to having lots of ResultsOfTest objects lying around.
Go check out the CLR profiler[^], or use a tool like Ants Memory and Performance profiler[^].
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Moral Muscle
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Judah Himango wrote: When you're done using the SqlDataReader, call Dispose() on it. This will release some unmanaged resources and may also allow some managed objects to eventually be freed. The same goes for your SqlCommand and your SqlConnection.
I am disposing the OracleDataReader (and OracleCommand and OracleConnection). The only thing
Judah Himango wrote: Another thing might be your call to db.UpdateTestResults(ref testResult). If you're storing your testResult somewhere, it won't be freed, obviously.
db.UpdateTestResults(ref testResult) simply builds the SQL (either insert or update), connects to the database, performs an ExecuteNonQuery, cleans up and returns.
Thanks for the links -- I'll check them out.
--G
|
|
|
|
|
Ok, well if the reality of things is that you're allocating too many objects before the GC can collect them, you are certainly free to call GC.Collect(). It's not recommended as the GC supposedly adapts to its usage, but you're not the first case I've read where the GC has become too lazy.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Moral Muscle
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
|
i have a form containing labels pictures and user controls
how can i print the form containing them just like it appears
through my search i found JUST "How to print a document"
|
|
|
|
|
The simplest way I would think is to use the Win32 API to capture a picture. Take a look at the following articles (you'd need to use the form's handle rather than the desktop's one).
Screen Capturing (.NET 2.0 & pure managed)
Screen Capturing
Capturing the Screen Image in C#
Just do a search for screen capture in Code Project articles, there's lots of them!
-- modified at 12:47 Wednesday 15th March, 2006
[mod]Sorry forgot to say, once you've got the image then you just need to draw it on the printer's canvas like anyother text / image[/mod]
Ed
|
|
|
|
|
Thanx 4 ur help, i solved the problem by drawing the shapes of the controls on a document and print this document
|
|
|
|
|
Not to burst your bubble but what happens when you run the program under for example Windows XP when you've been running it under 2000? You won't get the themeing.
Sorry if my assumption is incorrect
Ed
|
|
|
|
|
i need a program that sums the number values of a nuber for example:
when i enter the number 12345 it sums numbers values 1+2+3+4+5=15..
pls help....
also tnx for ur helps
|
|
|
|
|
Loop through the characters in the string, convert each character to a number, and add them together.
---
b { font-weight: normal; }
|
|
|
|
|
Or divide with 10 until you get to zero...
num=next%10;
sum+=num;
next=next/10;
|
|
|
|
|
We won't do your homework for you. You've already received two answers with different suggestions, but if you need more help, try yourself before, and then post the code telling us what exact problem you are having.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Salutations,
I'm doing an editor wherein I need some syntax highlighting.
Also, let it be known that I'm using Mono.
It all comes down to a rather simple question: How do I set some text to a specific color or weight?
Thanks!
- -
Regards SirErugor
|
|
|
|
|
This is a complex task, why don't you have a look at the source for SharpDevelop.
Ed
|
|
|
|
|
Is it written using Mono-libraries?
Because I don't think so and that is the single must
- -
Regards SirErugor
-- modified at 11:48 Wednesday 15th March, 2006
|
|
|
|
|
SirErugor wrote: Is it written using Mono-libraries?
Because I don't think so and that is the single must
I would think that the principles of the algorithm to determine syntax highlighting is the same regardless of the language or framework.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
I don't thinks great care has been taken to make it portable to mono however there is a port called MonoDevelop. I don't know if this runs on Windows but I'd be pretty confident that it does (at least the text editor portion) because it's written using Mono.
Ed
|
|
|
|