how to place a textbox in a particular cell?

Posted by Vforvijay under VB.NET on 3/4/2011 | Points: 10 | Views : 1730 | Status : [Member] | Replies : 5
hi.. i need an requirement , i want to place a text box in a selected cell in datagrid ..in vb.net...its urgent




Responses

Posted by: Karthikanbarasan on: 3/4/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Try like the below code


custom binding

<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text="<%# textID %>"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>

binding from the datasource
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text="<%# bind("textID") %>"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>


Thanks
Karthik
www.f5Debug.net

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 3/4/2011 [Member] Starter | Points: 25

Up
0
Down
hi.. i need code for windows application .......

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 3/4/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
OK do you want code to place the textbox in a data grid view in windows application using VB.Net? is that rt?

Thanks
Karthik
www.f5Debug.net

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 3/4/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
By Default in a datagrid every cell/column is of type DataGridViewTextBoxColumn.. So can you please let us know your requirement in details ...

Thanks and Regards
Madhu

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 3/4/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
dataGridView1.Rows[RowIndex].Cells[ColumnIndex].ReadOnly = false;

dataGridView1.CurrentCell = dataGridView1[ColumnIndex, RowIndex];
dataGridView1.BeginEdit(false);


Use this code to turn the cell into an editable text box so that you can write into the cell

Thanks and Regards
Madhu

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response