Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3696778
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:46:48+00:00 2026-05-19T04:46:48+00:00

Apollogies for the weird title. I didnt know how else to put it. What

  • 0

Apollogies for the weird title. I didnt know how else to put it.

What i have is 3 TextBoxes Data-Bound to some values.

What i need to do is have the value of 1 of the TextBoxes Automatically compute as a result of a calculation of the other 2 textboxes.

After some Google’ing, i found that using the IMultiValueConverter Interface should solve my problem. It does. But only 1 way.

For example:

TextBox 1 * TextBox 2 = TextBox 3

But the reverse is also true:

TextBox 3 / TextBox 2 = TextBox 1

The latter is what i’m having trouble with completing. No matter what i do, the reverse calculation wont stick.

I’ve Implemented 2 IMultiValueConverters, each for the 2 TextBoxes(since its 2 different calculations).

Converter 1:

Public Class SalaryConverter
Implements IMultiValueConverter

Public Function Convert(ByVal values() As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IMultiValueConverter.Convert
    Dim salary As Double = 0
    salary = (Math.Round(values(0) * (values(1) * 4)))
    Return salary.ToString("C")
End Function

Public Function ConvertBack(ByVal value As Object, ByVal targetTypes() As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object() Implements System.Windows.Data.IMultiValueConverter.ConvertBack
    Return Nothing
End Function

End Class

Converter 2:

Public Class RateConverter
Implements IMultiValueConverter

Public Function Convert(ByVal values() As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IMultiValueConverter.Convert
    Dim rate As Double = 0
    rate = ((values(0) / values(1)) / 4)
    Return rate.ToString("C")
End Function

Public Function ConvertBack(ByVal value As Object, ByVal targetTypes() As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object() Implements System.Windows.Data.IMultiValueConverter.ConvertBack
    Return Nothing
End Function

End Class

You’ll see that the Return values for the ConvertBack methods is set to Nothing. This is because whenever i return the value parameter, i get an exception saying i cant convert from string to 1-dimensional array.

What am i doing wrong?

Any help is much appreciated.

Thanks in Advance.

P.S. I am fairly new to Converters. I only started playing around with it recently.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:46:49+00:00Added an answer on May 19, 2026 at 4:46 am

    A multi value convert works as this :

    1. the Convert method requires n input parameters and convert it into 1 result. In your case : TextBox 1 + TextBox 2 => TextBox 3
    2. the ConvertBack is the reverse : it takes 1 input parameter and convert it into n results. In your case : TextBox 3 => TextBox 1 + TextBox 2

    So your ConvertBack should return an array containing values of TextBox1 and TextBox2…
    If you want to update only TextBox1 for exemple, you can do :

    return new object[] { myTextBox1String, Binding.DoNothing };
    

    EDIT : link to MSDN ConvertBack : http://msdn.microsoft.com/en-us/library/system.windows.data.imultivalueconverter.convertback.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies for the poor question title. I have two tables, jobs and Persons-Jobs. Jobs
Apologies for the unweildy title, this is a very difficult question to put into
Apologies in advance for the length of this question! I have a data structure
Apologies if the Topic title isn't accurate, I didn't really know how to express
Some time ago I made a script that takes some text and returns it
I trying to do some very basic string processing in C (e.g. given a
Apologies for a simple question, but I'm very new to Perl! I have an
Apologies if this has been answered previously. Say I have the following table: colA
Apologies, as this may seem a very weird question. All of my experience in
Apologies if the title above is a little convoluted, writing these things in plain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.