|
I created a BMI program. I am having a problem with rounding numbers.
I tried the Double, Constant, and Short. But it still results long numbers.
Can anyone he lp me.
bravo659
|
|
|
|
|
I recently converted a project from VB.NET to C# and discovered that VB.NET has some very entertaining ideas about number rounding. I think though that you're saying you want to control how many digits a floating point number has to the right of the point ? The .Format method will do that for you.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thannk you for youre reply to my inquiry. I will try it and let you know how it went.
bravo659
|
|
|
|
|
I have question, not related to the problem, but you mentioned in your reply that you are converting a program from VB.Net to C#. Can you please tell me why you made that decision. I am working on this web application using VB.Net. I was thinking about converting to C# but still can't make a decision. What could be the advantages since both are now Object-Oriented.
Thanks for you reply.
|
|
|
|
|
I had to use VB.NET for an ASP.NET job, and I found it to be even worse than I imagined. Yes, both are OO, and both compile to MSIL, however, VB.NET is incredibly ugly, and has some 'features' that are plain astounding. For example, a function will return false, Nothing or 0 ( depending on the return type ) by default. A blank string is the same as Nothing, if you compare them. I was so disgusted that I started a couple of threads on it, and some of the comments I got from people with a background in VB6 included that VB.NET was initially a good design, until all the VB6 users complained about things that had (rightly) been removed. Now, VB.NET adds a lot of syntax to make it possible to use it in a clean way, but very few users know about it, they keep using things like CType and IIf. Another user informed me that the C# MSIL compiler generates more efficient ( i.e. faster ) code. Another told me that any VB6 programmer who was worth anything had moved to C# because of the mess they had to make of VB.NET to keep the legacy coders happy.
In the end, it's obvious that VB.NET is a dead duck. Unlike VB.NET, C# is a new language, designed to be OO, designed to be clean, designed to be a serious language. VB was designed for beginners, and VB.NET carries it's legacy. I don't see why Microsoft need two proprietary languages, and C# is obviously the one they are putting their efforts in to. The gap between C# and VB.NET will grow until VB.NET can be dropped with nary a cry of complaint.
If more reason is needed, just compare how many people are answering C# questions/writing C# articles compared to VB.NET here on CP.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks Chritian.
You are right, even for the .net job openings, people ask for C# and not VB.Net.
|
|
|
|
|
I found the answer, i am using Math.Round to round off the numbers n the BMI project.
bravo659
|
|
|
|
|
Hi,
I have wrote a small VB application that opens up an Excel spread sheet. However when I close my VB application the Excel process is still showing as running in Task Manager. Would you have any idea? Here's the simple code sample:
Private Sub Command1_Click()
Dim XL As Excel.Application
Dim WB As Excel.Workbook
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open("C:\temp\Anyold.xls")
WB.Close False
Set WB = Nothing
XL.Quit
Set XL = Nothing
End
End Sub
|
|
|
|
|
If you are using createObject you dont need to declare the type as Excel.Application or Excel.workbook. You dont even need to reference the excel object library. Try the following:
Private Sub Command1_Click()
Dim XL As Object
Dim WB As Object
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open("P:\Tolroy Manor\Data Store\Map Production\map_status.xls")
WB.Close False
Set WB = Nothing
XL.Quit
Set XL = Nothing
End
End Sub
Jon
|
|
|
|
|
Thanks. I have tried your code but Excel.exe still shows as running in Taskmanager. Would you have any other ideas? Thanks in advance.
|
|
|
|
|
XL.Quit() would do close Excel. Everything seems OK in this code. The problem lies somewhere else. Maybe some feature the workbook introduces (running macro or something). You should also consider upgrading to Excel2003 if you haven't done so.
|
|
|
|
|
You need to use "Marshal.ReleaseComObject()".
|
|
|
|
|
OK I've tried it in VB.NET and it worked fine without Marshal.ReleaseComObject()
I mean, Excel2003 has quit without it.
But the optimal solution would include your line.
|
|
|
|
|
I think you'll want to use the "Marshalling" especially if your users can create multiple Excel objects from within your application. You'll see them hanging around in the "Task Manager" if you don't handle them. At least that was my experience.
|
|
|
|
|
is there a way to use ms access as the backend for an application developed
in ppc 03? If so, are there some resources for sample code for connecting to
the database, opening the database, retrieving records, modifying records
etc.?
Thanks in advance for any help
|
|
|
|
|
What's "PPC 03"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry, that was a poorly worded question. The app was developed in vb.Net for a Pocket PC 2003 (ppc 03) device.
|
|
|
|
|
In that case, your question would be better handled in the Embedded/Mobile Forum[^]. It really has nothing to do with VB.NET. It's a matter of whether the Pocket PC and the .NET Compact Framework has support for OLE Databases, a question I am hardly qualified to answer.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All,
I have a VB Form which has a Browser Control within. Now I would like that when a VB button is pressed (on the window form) a cookie is set and when i load a particular asp page within the browser control it reads the cookie.
The problem i'm having is setting the cookie from the VB.Net part. Is there a way to do it or at least is there another way to transfer data from VB.NET application to the ASP page.
Can anyone help pls!?
Thanks in advance
Nick
|
|
|
|
|
That's a really poor method of transferring information to a website, and will more than likely fail. Parameters are usually passed in the URL string. The format of which depends entirely on the site. What are you trying to do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave
thanks for your reply..
well i said in my previous post i am creating a VB.Net application which has a WebBrowser within. The story behind it is quite simple as my client wants this particular system and i've suggested to write an application which would be accessed via the Browser (ASP.NET) but he refused! Since i know this guy quite well, i'm pretty sure that after a couple of months he would want it acessed via the Browser...so to facilitate this i've written the main system using ASP.NET and created a client using VB.NET and will eventually load all the ASP pages within. Now the VB client app on loading will ask for the user name and password and in some way i need to transfer the user information to the browser.... i thought i could have done it through a cookie...though through your reply it seems that it is not a suitable method!
Any suggestions would be greatly appreciated!
Thanks once again
Nick
|
|
|
|
|
Uhhhh... You're adding a HUGE level of complexity to the client portion that you don't need to. If your just going to wrap the browser in a Windows app, don't. Your wasting your time and your clients.
In a situation like this, the core of your application should be written as a WebService. This WebService can be accessed by your ASP.NET application or from a Windows application. The data processing portion of this system will be entirely inside the WebService.
Now, the visual side of this app can be done by 2 independent applications. One, by an ASP.NET app that generates the HTML interface for your app in a browser, and the other, by using a normal Windows application. You must keep in mind the the ASP.NET and Windows applications are just the user interface! Visual's only! They will rely entirely on the WebService to handle all of the data processing your app does.
With all the data processing in a WebService, you can stick to writing the Windows app without worrying about how your going to get data into and out of a WebBrowser control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Wow... thanks once again
I was planning my app as follows:
GUI: VB.NET and ASP.NET
Business TIER: Class based
Data Tier: Class Based
Haven't considered much about webservices! Though i think that WebServices are not much different from Class (viewed from my own unknowledged perspective).Am I correct or? So i could work with webservices!
What i know is that when WebServices are consumed they are received as XML, right? Since my app will contain some sensitive data..will it still make sense or? and if so will webservices return DataSets (i assume so)?
any help would be greaTLY APPRECIATED...and sorry for the stupid questions..though i quite new to this technology...
Kind Regards
Nck
|
|
|
|
|
Well, I barely have time to look at my own code, let alone someone elses. But, I can point you at a starting point for Web Services, here[^]. On the far right of the page, you'll find Web Services Basics[^]. Start there.
Everything in Web Services is passed back and forth using SOAP, which is a lightweight, XML-based messaging framework.
Does it support encryption and security? Yes! Make sure you download and install the Web Services Enhancements (WSE) 2.0 SP2 for Microsoft .NET[^] to get the latest encryption and security support.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi to all,
i have one problem with a scanner:
I have found here the sample Twain Scanner that work with Epson scanner.(1640Su)
When I ask to Aquire from Twain
nothing seems to happen
My scanner is visible and work with other programs.
please answer soon
Thanks
MAssimo
|
|
|
|