Q:

Table Of Contents / Memoir - Replace page number with chapter number

I am having trouble tracking down what I need to do in order to replace the page number from the standard Memoir \tableofcontents.
Using the standard \tableofcontents I get: (where 5 & 9 are page numbers)

1 Chapter....................... 5
2 Another Chapter.......... 9

And the goal is:

Chapter....................... 1
Another Chapter.......... 2

\renewcommand{\chapternumberline}[1]{} I found will remove the chapter number from the left of the contents.
And \renewcommand{\cftchapterformatpnum}[1]{} will allow me to modify the part number but I think I may be heading in the wrong direction?  Possibly the command that describes the format and simply remove the page number and replace that section with the code that outputs the chapter number but I haven't had any luck identifying that.

A:

It's possible to define the \mempreaddchaptertotochook and \mempostaddchaptertotochook hooks to prevent that \addcontentsline writes the page number to he .aux file already.
However, this does not yet work with hyperref due to the special additions by hyperref. 
\documentclass{memoir}

\let\origaddcontentsline\addcontentsline % Store the original definition of `\addcontentsline`

\renewcommand{\mempreaddchaptertotochook}{%
  \renewcommand{\addcontentsline}[3]{%
      \addtocontents{##1}{\protect\contentsline{##2}{##3}{\thechapter}}} % Use the chapter number, not the page number
}

\renewcommand{\mempostaddchaptertotochook}{%
  \let\addcontentsline\origaddcontentsline%  We've written the chapter entry to the toc, now switch back to the original version to get section etc. and other entries correctly!
}

\renewcommand{\chapternumberline}[1]{}

\usepackage{blindtext}

\begin{document}
\makeatletter
\tableofcontents
\chapter{My Chapter}
\blindtext[20]
\section{A section}
\blindtext
\chapter{Another Chapter}
\end{document}

