What you show is the driver but the model is missing and the view is missing.
The model that in this case we only have one field we would define it as:
Public Class ModeloIndex
Public Property codigo As String
' aqui puedes añadir mas campos
End Class
The View that includes a form with a field
<div>
@Using Html.BeginForm("Modal_Encuesta", "Home", New With {.ReturnUrl = ViewBag.ReturnUrl}, FormMethod.Post, New With {.class = "form-horizontal", .role = "form"})
@Html.TextBoxFor(Function(m) m.codigo, New With {.class = "form-control"})
@<text>
<input type="submit" value="Submitir" Class="btn btn-default" />
</text>
End Using
</div>
And the controller:
' Para llegar aquí con GET la url sería: http://... ~/Home/Index?codigo=Valor
Function Index(m As ModeloIndex) As ActionResult
'el valor de codigo viene y va en el modelo en m.codigo
Return View(m)
End Function
'
Function Modal_Encuesta(m As ModeloIndex) As ActionResult
'
'//ViewBag.idcodigo = m.codigo
'//el ViewBag no sirve pues el valor ya llega a la vista en m
'
'
'//Tiene que existir una vista llamada Index.cshtml o Modal_Encuesta.cshtml
'//Falta decidir el resto de la estructura. Tal como está funciona con única Vista
Return PartialView("Index",m)
End Function
I think the question is very basic and the answer is too.
It is a functional skeleton to start assembling forms with MVC and Visual Basic
I hope this helps you.