|
Hello to everyone. for my project i need to display some data in a datagridview. these data are contained in an Adodb.recordset object, that is given from an external class they gave me (and i am _forced_ to use adodb.recordsets).
the problem is, i can't set the datasource for the datagridview to be the recordset. i'll give you an example:
Dim dy As New ADODB.Recordset
Dim query As String = "SELECT * FROM table1"
''MyConn is an instance of the class i must use
MyConn.OpenRecordset(dy, query)
at this point i would write:
DataGridView1.DataSource = dy
it doesn't give me an error, but it doesn't work either, my datagridview remains empty.
is there any way to work on it without using datasets? i sadly have to use recordsets...
thanks in advance and sorry for my bad english.
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
Since the ADODB.Recordset class doesn't support the required Interfaces, you can't use it to bind to a DataGridView. You'll have to translate it into a DataSet object to use the data.
If you're writing the code, why on earth do you HAVE to use the older classes???? I see no point to it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i HAVE to use the older classes because i work in a place full of quiche-eaters, who programmed in vb 6 until two days ago, and they suddenly decided to go VB.NET. so they hired me (and i am a c# programmer, who programmed serial interfaces with no experiences on databases, not even a vb.net one) and they gave me their old classes, just automatically converted. and of course, they forbid me to rewrite the class from scratch, because otherwise they would not be able to use it. this is my unlucky story...
however this morning i found a way, i use an OleDb.OleDbDataAdapter and with the method Fill i convert the recordset to a datatable. thanks anyways for having listened to my rant! ^__^
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
|
Dave Kreskowiak wrote: Wouldn't be able to use it or wouldn't be ablt to understand it?? There's a huge difference you know!
they won't understand it, and thus they won't be able to use it when i'll quit the job (in september, i hope )
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
Don't you hate being the most intelligent person in the room?? Noone to learn anything from...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i should have never taken this job, but you know, they caught me with a "WILL CODE FOR FOOD" sign around my neck...
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
My employer wants a streaming ticker tape on the bottem of the tv screen like the stock market to show precentage of work done on current projects and any messages for employees. It needs to also be up to date maybe 5-10 min update cycle and would use a wireless barcode scanner to update said precentage I've been coding for about 2 months in the real world and not sure if this is way out of my scope. Sorry for the bother but I'm lost thank you for any help.
scott
|
|
|
|
|
|
How to add icons to main menu items...???
<blink>FeRtoll Software.net
------------
E-Mail me
WebPage
|
|
|
|
|
Sometime I wonder why we even put a Search box on CodeProject...
Articles[^] resulting from searching for "menu icons".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
jea buth i want to use enablevisualstyles! not own drowing
<blink>FeRtoll Software.net
------------
E-Mail me
WebPage
|
|
|
|
|
EnableVisualStyles won't draw the icons for you. Neither will anything else for that matter.
You either have to find a component to do it for you ($$$) or you draw them yourself using ownerdraw. Or, switch to VB.NET 2005.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am using VisualBasicExpress Edition, In my VB.NET Win forms application I declared textbox as Shared in order to access it from other Forms and am getting this warining upon building my application.
-------------------------------------------------------------------------
Access of shared member, constant member, enum member or nested type thr
ough an instance; qualifying expression will not be evaluated.
-------------------------------------------------------------------------
My Code
-------------------------------------------------------------------------
Partial Class frmMain
Inherits System.Windows.Forms.Form
Public Shared WithEvents txtNameAs System.Windows.Forms.TextBox
Me.txtName = New System.Windows.Forms.TextBox 'warning on this line
Me.Controls.Add(Me.txtName) 'warning on this line
End Class
-------------------------------------------------------------------------
How can I avoid these warnings?
Thanks in advance
Sujan
.Net Programmer, Software Engineer
|
|
|
|
|
You can't use the "Me" keyword to access shared members.
If a member is declared as shared then it does not belong to any instanc.
SImply refrence it by it's name...
--------------------------------------------------------
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi,
I have a CAB file which contains a dll file...it is present in the web server.The downloaded from the users PC get registered Automatically.
Now I have modified the DLL code...made a new dll(same name) ,made one new cab file and want to replace with the old CAB file in the server.
shall I make the dll with different name and make the new CAB file
thanks bye
Paritosh
|
|
|
|
|
hi
I had downloaded a dll from web and I want to unregister it.
I didn't found in sysyem32 folder..also regsvr32 /u "dllname" is not working.
That dll is present in c:\winnt\Downloaded Program Files
So can I delete it ??or tell me the process to unregister.
thanks
Paritosh
|
|
|
|
|
I fail to see what this has to do with VB.NET, but...
To unregister the .DLL, if it has such a capability, try supplying the full path to the .DLL to REGSVR32:
regsvr32 /u "C:\documents and settings\someone\somepath\dllname.dll"
If it comes back and says that the "DLLUnregisterServer entry point was not found", then you could just delete the file.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi i built a treeview with data binding that reads the nodes and add it to the tree by Recursion and i took the code from this web site (FillTree) now i want to select a node by its text not the index couse i cant know the index of the nodes becouse its un limited tree plz i need a help and thx
HADEEL BARAKAT
|
|
|
|
|
You'll have to enumerate through all the treenodes and their child nodes collections to find the Text your looking for. Just write a small little method that calls itself recusrively to find the node and select it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Environment
---------------
Visual Studio.NET 2003 Version 7.1.3088
.NET Framework 1.1 Version 1.1.4322 SP1
XP Professional 5.1.2600 SP2 Build 2600
Problem Description
-----------------------
I have an mdi parent form.
When it opens it creates 2 instances of the same mdi child form.
The mdi child form contains a textbox and a button.
In the keydown event of the textbox I trap the enter key and display the
contents of the textbox.
In the button click event I display a message box "Click".
When the application runs the 2 child forms are created and the second child
form has focus.
Using the mouse set focus on the textbox and press enter. The message is
displayed as expected.
Now use the mouse to set focus on the first child forms textbox and press
enter.
This time the button click event fires !!
Next set focus on child 2 textbox and press enter - this again works ok.
Finally return to child1 and press enter in the textbox - this now works and
displays the correct message.
If you take the button off the child form the problem doesn't occurr. Also
when both textboxes are working correctly it breaks again if you click the
button, select the other child form and then return to the original child
form.
I have included the source for a test app using VB.NET but the same problem occurs when using C#.
Looks like a bug to me but I would be interested to know if anyone else has
experienced this problem or know how to prevent it from hapenning ?
--------------------------------------------------------------------
Source Code
--------------------------------------------------------------------
MDI Parent Form
--------------------------------------------------------------------
Public Class frmMain
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<system.diagnostics.debuggerstepthrough()> Private Sub
InitializeComponent()
'
'frmMain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(718, 350)
Me.IsMdiContainer = True
Me.Name = "frmMain"
Me.Text = "frmMain"
End Sub
#End Region
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Create 2 child forms at startup...
Dim frm1 As New frmChild
With frm1
.MdiParent = Me
.TextBox1.Text = "CHILD1"
.Show()
End With
Dim frm2 As New frmChild
With frm2
.MdiParent = Me
.TextBox1.Text = "CHILD2"
.Show()
.Left = frm1.Width + 50
.Top = frm1.Top
End With
End Sub
End Class
--------------------------------------------------------------------
MDI Child Form
--------------------------------------------------------------------
Public Class frmChild
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<system.diagnostics.debuggerstepthrough()> Private Sub
InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(21, 48)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(9, 12)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'frmChild
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(127, 86)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "frmChild"
Me.Text = "frmChild"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox("Click")
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
MsgBox(TextBox1.Text)
End If
End Sub
End Class
|
|
|
|
|
If I remember correctly, the first click will set the focus to the new form, the second click will actually give the focus to the control on it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes - thats right but when I run this test app I can click as many times as i like on the form to give it focus but the button_click event always fires instead of the textbox_keydown event when I press enter in the textbox.
Also - the fact that I am trapping the enter key press is not important - it behaves the same when trapping any other key so I don't think that accept button behaviour is important here.
Once in this state the opnly way to recover the correct events firing is to move focus to a different child form and then move focus back. At this point everything is magically ok again until you perform the following steps again
click the button on child1 and say ok to the 'click' message
move focus to child2 (click the window handle for example)
move focus back to child1 (click anywhere on the form)
give focus to the textbox on child 1 and press enter (you should see the contents of the textbox displayed in a messagebox but instead you see the click message meaning that the button_click event fired when the textbox_keydown event should have fired.)
This happens every time i run this app and does the same thing when written in C#.
|
|
|
|
|
I tested your app in VB.Net 2005, I didn’t find anything wrong, but when I set to child form’s AcceptButton property to Button1 your problem occurred.
Chatura from Pearl of the Indian Ocean.
|
|
|
|
|
Thanks for checking but I am definitely getting this problem every time i run the app (unless i've lost it completely !!).
I'm using the 2003 version of VS.NET so it is possible it has been fixed in your version.
I'll try get hold of 2005 to test it.
Thanks again...
|
|
|
|