|
Thank You
|
|
|
|
|
For Each dg As DataGrid In DataGrid1.DataBindings
Dim cb As CheckBox = CType(dg.Item.Controls(1), CheckBox)
If cb.Checked Then
Dim id As Integer = Convert.ToInt16(dg.Item.Text)
endif
the above code is vb.net windows application code.
when i run the above code,the following error is shown.
"Overload resolution failed because no accessible 'Item' accepts this number of arguments"
this error shown in dg.item (2nd and 4th line).this code is for edit.how to solve this.can u send other vb.net windows apllication code for edit a record in datagrid.
|
|
|
|
|
Your code all the way though assumes that it's cast operations will work. Write code that is more defensive, step through it in the debugger, and you will probably see what the problem is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This code has so many problems on so many levels, it's hopeless to try and save it.
You said you wanted to change the status of a field in the data that this grid is showing? You don't do that in the DataGrid, you do it in the DataSet, or DataTable, or whatever else this grid is bound to.
Think of it this way. The DataGrid show you a view of your data, it doesn't hold the actual data it's showing you.
|
|
|
|
|
Hi All,
I am working with VS.NET 2005 datagridview. For the past 2 hours i have been screwed up by this grid behavior. I have 12 columns in my datagridview and I want 1 of them (which is checkbox) to be editable like user can check/uncheck it. When I bound the grid to datasource (dataset), it will not allow me to check/uncheck the checkbox column. I debug it and it shows the column readonly property set to false which is OK, but why it didnt allow me to edit it. Same happens in Virtual mode of the grid.
Do you have any idea how can I make columns editable in normal and virtual mode with Bound columns?
Thanks,
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Did you set the DataGridView.ReadOnly property to True ?
|
|
|
|
|
No the readonly property is set to false. And I have set ReadOnly property for each column
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Got it...fixed. I have the following set in my designer file
Me.dgMember.RowTemplate.ReadOnly = true
Not how that set up
Thanks anyways..
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Please can someone tell me how to drag a file from my explorer window on my form and load the file into a rich text box that i have created at runtime? thank you, in advance
|
|
|
|
|
hi,
to do this, you need to set the allowdrop porperty of the control to true.
then you need to write two event-handlers to handle the events fired when you do drag & drop operation.
below is a code sample in C# but you can easily convert it to VB
//you need to set the property and assign eventhandlers
this.richtextbox1.Allow = true;
this.richtextbox1.DragDrop += new DragEventHandler(richtextbox1_DragDrop);
this.richtextbox1.DragEnter += new DragEventHandler(richtextbox1_DragEnter);
//then write the event handlers
private void richtextbox1_DragEnter(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void richtextbox1_DragDrop(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] file = (string[])e.Data.GetData(DataFormats.FileDrop);
fileName = file[0];
//Now that you have the file name of the file, you can read it and display its contents
}
}
hope this helps.
regards
|
|
|
|
|
on formload
textbox1.dragdrop=true
Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop<br />
If (System.IO.File.Exists(CType(e.Data.GetData(DataFormats.FileDrop), Array).GetValue(0).ToString()) = True) Then<br />
If (System.IO.Path.GetExtension(CType(e.Data.GetData(DataFormats.FileDrop), Array).GetValue(0).ToString()) = ".txt") Then<br />
TextBox1.Text = System.IO.File.ReadAllText(CType(e.Data.GetData(DataFormats.FileDrop), Array).GetValue(0).ToString())<br />
Else<br />
MessageBox.Show("select the .txt extention file")<br />
End If<br />
<br />
End If<br />
End Sub<br />
<br />
Private Sub TextBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter<br />
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then<br />
e.Effect = DragDropEffects.Copy<br />
End If<br />
End Sub
Hope this may help You.
|
|
|
|
|
Thanks for the code... technically that should work, but I create my rich text box at runtime, so i cant call its events, or atleast... i am unsure of how to! please help? thanx guys!
|
|
|
|
|
DaxBooysen wrote: i am unsure of how to! please help?
replace textbox with Richedittextbox
Actually i tried it with textbox.It is very simple. replace textbox with richedittextbox
|
|
|
|
|
I have no problem with that, its the fact that i create it at RUNTIME... i dont place it on my form at design time, so when i try make an event for a text box that has not been created yet i cant! know what i mean? thanx again!
|
|
|
|
|
ok What code u r writing?
|
|
|
|
|
i create a rtf box in many places and set it as a child control of a tab control... but i call it up like this when i want to change its values...
<br />
<br />
Dim rtf As New RichTextBox()<br />
rtf = TABS.TabPages(TABS.SelectedIndex).Controls.Item(0)<br />
<br />
and so you see... since its created at runtime... how do i call its events? thanx,
dax
|
|
|
|
|
then write the code on each control which is provided to u.
|
|
|
|
|
DaxBooysen wrote: Dim rtf As New RichTextBox()
rtf = TABS.TabPages(TABS.SelectedIndex).Controls.Item(0)
Doesn't this create a control, then discard it for one that's already within the tab page ?
Either way, you can attach events to a control in code, at least you can in C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If you create a control at runtime, you have to wire up the events yourself at runtime, just like the designer generated code does when you drop a control on the form.
Lookup AddHandler and RemoveHandler on MSDN and it'll show you how to do this...
|
|
|
|
|
THANX!!! you rock man! that worked!
|
|
|
|
|
Is there any event that automatically get fired when the mouse goes out of the form.
|
|
|
|
|
That would be the 'leave' event ( or 'mouseleave' ). I've found it more reliable to set a timer and check for myself if the mouse is still over the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
you should use mouseleave event
|
|
|
|
|
That's what I said, but I recall it not worknig out for me at times, hence my suggesting an alternative.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to send this command to epp.registry.tryout.be at the port 33128. This is an EPP server which is to be connected through SSL connection
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<hello/>
</epp>
This will generate a Greeting in the same (XML) format. I want to store that greeting to a string using some xml parser i am not sure.
Please help and provide the code in vb.net
Thanks
|
|
|
|