Showing posts with label sub. Show all posts
Showing posts with label sub. Show all posts

Saturday, March 31, 2012

Text box enter

How do I assign a sub to a textbox for when the user hits enter whilst the cusor is still within that textbox?I think you mean how can you execute some code when the textbox is submitted (essentially as event handler). Design your textbox in vs.net...then just double click the textbox and the sub is automatically created for you...then all you have to do is fill in your code.
Hi,

I think you are referring about handling the event for the enter key right?

In your code behind, you will find the handle event for the button click as below:-

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

End Sub

you need to add the textbox's text changed event to it as below:-

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click, TextBox1.TextChanged

End Sub

This should help you.

Thanks.
Many thanks
your welcome!

did that work for you?

thanks.

Monday, March 26, 2012

Text in dataGrid cell

I would like to read the text from my dataGrid cell.

Private Sub dgdPie_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles dgdPie.ItemCommand

If e.CommandName = "PieName" Then 'user clicks on link button
cellText=e.Item.Cells(4).text
end if

end sub

CellText is always '', no matter which cell I read.

I don't know why? I have text in all cells.

Regards,SHi,

Is that a template column, or a databound column you're trying to access?

------------------------
All that glitters has a high refractive index.
www.mendhak.com

"simon" <simon.zupan@.stud-moderna.si> wrote in message
news:uN2os$T4FHA.3844@.TK2MSFTNGP10.phx.gbl...
I would like to read the text from my dataGrid cell.

Private Sub dgdPie_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgdPie.ItemCommand

If e.CommandName = "PieName" Then 'user clicks on link button
cellText=e.Item.Cells(4).text
end if

end sub

CellText is always '', no matter which cell I read.

I don't know why? I have text in all cells.

Regards,S
The column is:

<asp:TemplateColumn HeaderText="Description">
<ItemTemplate>
<%# Container.DataItem( "pie_description" ) %>
</ItemTemplate>
</asp:TemplateColumn
regards,Simon

"S.M. Altaf [MVP]" <smaltaf@.PLEASEDONTSPAMMEmsn.com> wrote in message
news:%238OKEXU4FHA.2532@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Is that a template column, or a databound column you're trying to access?
>
> ------------------------
> All that glitters has a high refractive index.
> www.mendhak.com
>
> "simon" <simon.zupan@.stud-moderna.si> wrote in message
> news:uN2os$T4FHA.3844@.TK2MSFTNGP10.phx.gbl...
> I would like to read the text from my dataGrid cell.
> Private Sub dgdPie_ItemCommand(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
> dgdPie.ItemCommand
> If e.CommandName = "PieName" Then 'user clicks on link button
> cellText=e.Item.Cells(4).text
> end if
> end sub
>
> CellText is always '', no matter which cell I read.
> I don't know why? I have text in all cells.
> Regards,S
try this

CType(e.Item.Cells(4).Controls(0), DataBoundLiteralControl).Text

"simon" wrote:

> The column is:
> <asp:TemplateColumn HeaderText="Description">
> <ItemTemplate>
> <%# Container.DataItem( "pie_description" ) %>
> </ItemTemplate>
> </asp:TemplateColumn>
>
> regards,Simon
> "S.M. Altaf [MVP]" <smaltaf@.PLEASEDONTSPAMMEmsn.com> wrote in message
> news:%238OKEXU4FHA.2532@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> > Is that a template column, or a databound column you're trying to access?
> > ------------------------
> > All that glitters has a high refractive index.
> > www.mendhak.com
> > "simon" <simon.zupan@.stud-moderna.si> wrote in message
> > news:uN2os$T4FHA.3844@.TK2MSFTNGP10.phx.gbl...
> > I would like to read the text from my dataGrid cell.
> > Private Sub dgdPie_ItemCommand(ByVal source As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
> > dgdPie.ItemCommand
> > If e.CommandName = "PieName" Then 'user clicks on link button
> > cellText=e.Item.Cells(4).text
> > end if
> > end sub
> > CellText is always '', no matter which cell I read.
> > I don't know why? I have text in all cells.
> > Regards,S
>