Solved

Conversion question

Posted on 2011-02-24
6
321 Views
Last Modified: 2012-05-11
Hi, I'm new to c# and am trying to convert this code. Thanks!

If CustAccount() = False Then

Else

If lblRec1.Text <> "" And txtPrice1.Text <> lblAAPrice1.Text Then Call UpdateCost(lblRec1.Text, IIf(txtPrice1.Text = "", 0, txtPrice1.Text), txtRRItem1.Text)

If lblTotalItemNo.Text > 100 Then
...
If txtTax.Text <> lblOldTax.Text Then Call UpdateCost(lblTaxRec.Text, IIf(txtTax.Text = "", 0, txtTax.Text))
End If
End If
...

If IsNumeric(txtTax.Text) = False Then
    txtTax.Text = 0.0
 ElseIf txtTax.Text = "" Then
    txtTax.Text = 0.0
 End If
0
Comment
Question by:avi7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 16

Expert Comment

by:Peter Kwan
ID: 34976793
I don't think it is appropriate to ask many such questions (with some parts repeating previous questions) without taking at a look at the experts' comments to your previous questions. Please take a look and try first.
0
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 500 total points
ID: 34976875
if ((CustAccount() == false)) {
    
}
else {
    if (((lblRec1.Text != "") 
                && (txtPrice1.Text != lblAAPrice1.Text))) {
        UpdateCost(lblRec1.Text, ( (txtPrice1.Text == "") ? 0 : txtPrice1.Text ), txtRRItem1.Text);
    }
    if ((lblTotalItemNo.Text > 100)) {
        if ((txtTax.Text != lblOldTax.Text)) {
            UpdateCost(lblTaxRec.Text, ( (txtTax.Text == "") ? 0 : txtTax.Text ));
        }
    }
    if ((IsNumeric(txtTax.Text) == false)) {
        txtTax.Text = 0;
    }
    else if ((txtTax.Text == "")) {
        txtTax.Text = 0;
    }
}

Open in new window

0
 
LVL 8

Expert Comment

by:crysallus
ID: 34977018
Yes, ditto pkwan's comment.

And kalpesh2804, there is no IsNumeric function in C#, unless the programmer defines their own of course, which I don't think is being implied here.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 20

Expert Comment

by:informaniac
ID: 34977286
And if u feel u hav got the solution kindly accept the solution and close the question. Tht would help everybody.
0
 

Author Comment

by:avi7
ID: 34984232
This code is still not working(IsNumeric is an old VB function) is there something in C#? Thanks!

if ((IsNumeric(txtTax.Text) == false)) {
        txtTax.Text = 0;
    }
    else if ((txtTax.Text == "")) {
        txtTax.Text = 0;
    }

0
 
LVL 8

Expert Comment

by:crysallus
ID: 34985526
Read your other questions please...

This question on IsNumeric is answered in the first post (mine) given to your question entitled 'Cannot implicitly convert type 'string' to 'double' '.

Re-asking questions that have already been answered is not a good way to impress people around here. You are just wasting people's time. In fact, this is probably my last post to one of your questions. I'm not trying to be rude, but evidently you need to learn how things work around here, and the impression you are giving is that you are simply trying to take advantage of the help being offered. Please make more of an effort in future.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question