function CalendarShare { Add-MailboxFolderPermission -Identity ${FromUser.Text} -AccessRights Editor -User ${ToUser.Text} }
When the program is run
Note: This is assuming that both $FromUser and $ToUser are textboxes
You aren't using your variable correctly for the identity parameter, should be:
function CalendarShare { Add-MailboxFolderPermission -Identity $FromUser.Text -AccessRights Editor -User $ToUser.Text} }