|
Imports System.Data.SqlClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Creating connection and command sting
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\northwind.mdb"
Dim sqlStr As String = "SELECT * FROM Employees"
' Create connection object
Dim conn As OleDbConnection = New OleDbConnection(conStr)
' Create data adapter object
Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn)
' Create a dataset object and fill with data using data adapter's Fill method
Dim ds As DataSet = New DataSet
da.Fill(ds, "Employees")
' Attach dataset's DefaultView to the datagrid control
DataGrid1.DataSource = ds.DefaultViewManager
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' Creating connection and command sting
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\northwind.mdb"
Dim sqlStr As String = "SELECT * FROM Employees"
' Create connection object
Dim conn As OleDbConnection = New OleDbConnection(conStr)
' Create data adapter object
Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn)
' Create a dataset object and fill with data using data adapter's Fill method
Dim ds As DataSet = New DataSet
da.Fill(ds, "Employees")
' Attach dataset's DefaultView to the datagrid control
Dim dv As DataView = ds.Tables("Employees").DefaultView
ListBox1.DataSource = dv
ListBox1.DisplayMember = "FirstName"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
' Creating connection and command sting
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\northwind.mdb"
Dim sqlStr As String = "SELECT * FROM Employees"
' Create connection object
Dim conn As OleDbConnection = New OleDbConnection(conStr)
' Create data adapter object
Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn)
' Create a dataset object and fill with data using data adapter's Fill method
Dim ds As DataSet = New DataSet
da.Fill(ds, "Employees")
' Attach dataset's DefaultView to the datagrid control
Dim dv As DataView = ds.Tables("Employees").DefaultView
ComboBox1.DataSource = dv
ComboBox1.DisplayMember = "FirstName"
End Sub
BYE
Imagine the I.T
|
|
|
|
|
Hi, I just install vs.net 2005 standard edition. I found that vs.net 2005 standard edition has sql reporting service as a report too. But they didn't include crystal report as a reporting tool.
I prefer to use crystal report than sql reporting service, and I found there is crystal report v11. My question is: If i purchase crystal report v11 install on my computer, could it integrate its feature with vs.net 2005 standard edition? So I can pass a query from my database application design in vs.net 2005 to view in crystal report.
Thank in advance
|
|
|
|
|
Hi ,
I am using a Web Browser control to show a web page for local preview.I want to include CSS to this control.how can I do it.
thanks In advance
|
|
|
|
|
The control works with CSS automatically. Do you mean you want to insert your own CSS into a page you otherwise have no control over ? You may be able to insert CSS into the document using local methods, I'm not sure.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks for every one who read the message,and i will remember u
question:
which function is used for round the image from the shimgvw.dll
Marius love u!
|
|
|
|
|
What do you waht to do ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
dear, Christian Graus
there is no such video that explaining, how to record user voice using microphone which interact with the interface..(VB.NET)
i have run a file related with recording voice in VB.NET but there is no any respones from the system..
so i have stopped... it will be easier, if there is any sample of voice recording with interface in VB.NET for me as a reference..
thanks a lot
|
|
|
|
|
Are you talking about recording a voice or are you trying to do voice recognition??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
recording a voice using Visual Basic.NET
thanks
|
|
|
|
|
Hello, I only recently started working in VB, so now I'm having an obvious syntax-wise question:
I want to hook the .Click event of an object (sectionItem), inheriting from Panel to a Sub in my class.
In C# this would simply be sectionItem.Click += new EventHandler(mySub) , but in VB I'm a bit confused.
Could someone point me to the right actions?
Tnx
|
|
|
|
|
you can use AddHandler in VB.NET inorder to bind an event dynamically
Like,
<br />
AddHandler btnClose.Click, AddressOf btnClose_Click<br />
where btnClose is a button and btnClose_Click is the function or the event handler for that button when that button is clicked
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Exactly what I needed. Thanks!
|
|
|
|
|
There are two options in VB:
1. As described by Mubashir.
2. Using a "Handles" clause:
e.g.,
Public Sub btnClose_Click(...<param list="" />...) Handles btnClose.Click
Some people prefer this more traditional VB way. However, of course this method only applies to cases that you know at design time.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
hi..
I hve design .net based C++ class library. I want to use it in vb.net proj.
My class library code compile without an error. But when i access that library in vb.net proj it gives me an error (its run time error)
error discription:
Unhandled Exception: System.BadImageFormatException: Could not load file or asse
mbly 'Appa, Version=1.0.2598.12775, Culture=neutral, PublicKeyToken=null' or one
of its dependencies. An attempt was made to load a program with an incorrect fo
rmat.
File name: 'Appa, Version=1.0.2598.12775, Culture=neutral, PublicKeyToken=null'
at Anna.MyModule.Main()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].
===========================================================
// Appa.h
#pragma once
using namespace System;
namespace Appa
{
public ref class MyClass
{
public:
int Add(int x, int y);
};
}
===========================================================
// This is the main DLL file.
#include "stdafx.h"
#include "Appa.h"
namespace Appa
{
int MyClass :: Add(int x, int y)
{
int k = x+y;
return k;
}
}
=================================================
//MyModule.vb
Module MyModule
Sub Main()
Dim obj As New Appa.MyClass
Console.WriteLine(obj.Add(10, 15))
End Sub
End Module
=================================================
plz help me guys
|
|
|
|
|
You'd be better off asking this in the C++ forum. My C++ is pretty rusty, but this doesn't look like a COM componet you've written, or a .NET assembly. You're trying to use a C++ style class in managed code, and that just isn't going to work. It needs to be rewritten using CLI (Managed C++) in order to be used the way your doing it now. But, like I said, you're in the wrong forum for an accurate answer to this question.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello,
How can I do a relation between a DataGrid and a ComboBox outside the DataGrid?
I need a help in syntax, using vb.net 2003 and sql server 2000
thank you
|
|
|
|
|
Not a very clear question, but if you bind a bindingsource to your datagridview, you can use the alter the currently selected row by changing the .Current property of the bindingsource.
I'm guessing you want to pick a row by selecting a value form your ComboBox, so you could do something like this:
Dim dgv As New DataGridView()
Dim bs As New BindingSource()
dgv.DataSource = bs
bs.DataSource = myDataSet
Dim cb As New ComboBox()
And then on SelectedIndexChange event of the combobox, you can set the bs.Current to the selected Value.
|
|
|
|
|
10x bertburtbort
but the question is that what i really need , the combobox brings its data from database.
when a selected value in the comboBox then its details displayed in the dataGrid
actually the data in datagrid is brought from an other table in the database
that is what i need
10x again
|
|
|
|
|
If someone could show me how i can loop the following code until end of the text file.
This would be much appreciated.
Dim FileReader As System.IO.StreamReader
FileReader = My.Computer.FileSystem.OpenTextFileReader("C:\SBL.txt")
Dim StringReader As String
StringReader = FileReader.ReadLine
Form2.ListView1.Items.Add(StringReader)
|
|
|
|
|
StringReader is a strange name for a string ?
Anyhow, you use a while loop. your string will return null ( Nothing in VB ) when the file is empty. Or you can use ReadAllText to get the strings out as a string array and use for each to iterate over that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: StringReader is a strange name for a string ?
It's name is what it does, so i think that the name is relevant.
|
|
|
|
|
It's also the name of a class, I believe. It threw me for a second, that's all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: It's also the name of a class, I believe. It threw me for a second, that's all.
Hmm, will have to check into that THANKS
|
|
|
|
|
WestSideRailways wrote: It's name is what it does
No, actually it's not. The string object doesn't read anything. It only contains data that was read.
If you want to write less confusing code, you should name the variable after what it contains or what it's used for, not after what some part of the code does when it uses the variable. Also, variables are generally not named with the first letter in capital, to distinguish them from classes and methods, and using data types in variable names is generally discouraged.
---
single minded; short sighted; long gone;
|
|
|
|
|