# Why doesn't the compiler like this?

**URL:** <https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895>\
**Category:** General\
**Created:** [August 5, 2015, 4:29pm UTC](https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895 "2015-08-05T16:29:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Albrecht](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_albrecht/32/817_2.png) [@Richard\_Albrecht](https://forum.xojo.com/u/Richard_Albrecht)\
**Post date:** [August 5, 2015, 4:29pm UTC](https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895/1 "2015-08-05T16:29:52Z")

</div>

Compiler error:  
There is more than one item with this name and it’s not clear to which it refers

What does this mean!

` txtMsg.Text.Replace( "MM/DD", md3Mo.Month.ToText + "/" + md3Mo.Day.ToText))
 `

Yet why does it then except:

` txtMsg.Text = Replace(txtMsg.Text, "MM/DD", _
  md3Mo.Month.ToText + "/" + md3Mo.Day.ToText)
  `

Inquiring mind like to know…

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [August 5, 2015, 4:35pm UTC](https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895/2 "2015-08-05T16:35:08Z")

</div>

In the top code, you didn’t assign the result to anything, but in the bottom code you did. Was that a typo or is it the answer?

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [August 5, 2015, 5:10pm UTC](https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895/3 "2015-08-05T17:10:51Z")

</div>

You probably want to do that:

```auto
txtMsg.Text = txtMsg.Text.Replace("MM/DD", md3Mo.Month.ToText + "/" + md3Mo.Day.ToText)
```

---

<div class="post-metadata">

**Author:** ![Richard\_Albrecht](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_albrecht/32/817_2.png) [@Richard\_Albrecht](https://forum.xojo.com/u/Richard_Albrecht)\
**Post date:** [August 6, 2015, 1:35pm UTC](https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895/4 "2015-08-06T13:35:31Z")

</div>

Duh! Simple enough!

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:52pm UTC](https://forum.xojo.com/t/why-doesnt-the-compiler-like-this/25895/5 "2020-10-29T17:52:43Z")

</div>


