|
Visual Studio versions can coexist quite happily, however the last one installed will "steal" the relevant file extensions, e.g. when you double-click a .cs file in Windows Explorer, it will open in the VS version you last installed.
|
|
|
|
|
Luc Pattyn wrote: when you double-click
Once can right click and choose "Visual studio version selector". That picks up the right version (most times).
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Hi all,
I have the below code I’m using [in VB.NET 2005] to populate three DataGridView’s I
have on my form without much success at the moment as the DataGridView
only displays one column of data once it has run :/
In the example I am just trying to get it working for one DataGridView
with the intention of passing in SQL to define the DataSet’s once its
working.
I am unsure weather I have missed something because I can view all the
data in the visualiser but it only seems to populate the one column in
the DataGridView.
Please help.
Scott.
Private Sub cboUserName_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cboUserName.SelectedIndexChanged
Dim lngUserID As Long
For i As Integer = 0 To ALWDBDataSet.Tables("tblUser").Rows.Count - 1
If ALWDBDataSet.Tables("tblUser").Rows(i).Item("UserName") = cboUserName.Text.ToUpper Then
lngUserID = ALWDBDataSet.Tables("tblUser").Rows(i).Item("UserID")
Exit For
End If
Next
'// Initialize a new instance of the OleDbConnection Class
objConnection = New OleDbConnection(strConncectionString)
'// Build query string
Dim strSQL As String = "SELECT * FROM tblUserLogs WHERE UserID = " & lngUserID
'// Initialize a new instance of the OleDbCommand Class
objCommand = New OleDbCommand(strSQL, objConnection)
Call PopulateGrid(dgvLogInfo, "tblUserLogs")
End Sub
Private Sub PopulateGrid(ByVal grd As DataGridView, ByVal strTable As String)
'// Initialize a new instance of the OleDataAdapter class
objDataAdapter = New OleDbDataAdapter
'// Initialize a new instance of the DataSet Class
objDataSet = New DataSet
'// Set the SelectCommand for the OleDbDataAdapter
objDataAdapter.SelectCommand = objCommand
Try
'// Poplate the DataSet
objDataAdapter.Fill(objDataSet, strTable)
'// Bind the DataSet to the DataGrid
grd.DataSource = objDataSet
grd.DataMember = strTable
'// Set the AlternatingRowsDefaultCellStyle.BackColor property
grd.AlternatingRowsDefaultCellStyle.BackColor = Color.WhiteSmoke
'// Set the CellBorderStyle property
grd.CellBorderStyle = DataGridViewCellBorderStyle.None
'// Set the SelectionMode property
grd.SelectionMode = DataGridViewSelectionMode.FullRowSelect
'// Set the AutoSizeColumnsMode property
'grd.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
Catch OleDbException As OleDbException
MessageBox.Show(OleDbException.Message)
End Try
'// Cleanup
objCommand.Dispose()
objCommand = Nothing
objDataAdapter.Dispose()
objDataAdapter = Nothing
objDataSet.Dispose()
objDataSet = Nothing
objConnection.Dispose()
objConnection = Nothing
End Sub
|
|
|
|
|
Soooo where are you binding the new dataset to the DataGridView?? I don't see it anywhere.
|
|
|
|
|
On line 17 of the PopulateGrid sub
'// Bind the DataSet to the DataGrid
grd.DataSource = objDataSet
grd being the DataGridView that is passed into the sub "Call PopulateGrid(dgvLogInfo, "tblUserLogs")"
|
|
|
|
|
Have you defined your own columns in the DGV or are you using the automatically generated columns?
|
|
|
|
|
Ah, well this is where I might be going a bit wrong then – please forgive my ignorance but I thought [as I could see all the data in the visualiser maybe] that the columns would not need to be defined explicitly, when I look at the data in the DataGridView after the procedure has run the column headings of the table are in there, but as I stated in the original post only one column has data in it
Tanks for the quick response.
EDIT: I used these two methods
grd.Columns.Clear()
grd.AutoGenerateColumns = True
And it seems to be working ok now.
Thanks for your help.
modified on Sunday, January 10, 2010 10:37 AM
|
|
|
|
|
I have a Windows Form which uses a Timer to automatically close itself if no user interaction occurs within a given time.
The form contains a Label, a Button and a ListView control.
I basically want to run my UserHasClickedForm() sub if the user clicks anywhere in the form before the Timer ticks.
I've used the Click event of each of the controls as shown below.
The code works for each control except the ListView. If I click on the ListView control at run time, the click event does not get raised.
Anyone know why this is, and what I could do to fix the problem?
Private Sub MyPopupDialog_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
UserHasClickedForm()
End Sub
Private Sub MyButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyButton.Click
UserHasClickedForm()
End Sub
Private Sub MyLabel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyLabel.Click
UserHasClickedForm()
End Sub
Private Sub MyListView_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyListView.Click
UserHasClickedForm()
End Sub
|
|
|
|
|
Did you click on an item in the ListView or a blank area??
Try wiring up the ItemSelectionChanged event as well as the Click event.
|
|
|
|
|
Thanks for the response Dave,
Using my code I've tried clicking on items in the ListView, blank area in the ListView control, Column Headers... Nothing seems to trigger a ListView_Click.
Ultimately I want to flag that the user has clicked somewhere on the form regardless of whether it's on a blank part of the form, a control on the form like a Button or a ListView Item, a blank part of the ListView control or a Header in the ListView control.
It seems to work as I would expect for all elements of the form except the ListView control, which has me stumped.
Then again perhaps there's an easier way than coding the click event of each individual element of the form?
Cheers
Paul
I'm always humbled that complete strangers are so willing to share knowledge and help each other out on this site
|
|
|
|
|
Paul Hasler wrote: It seems to work as I would expect for all elements of the form except the ListView control, which has me stumped.
Then again perhaps there's an easier way than coding the click event of each individual element of the form?
There is no easier way to do this. If you click on a control, you're no longer clicking in the form.
Like I said, wire up a different event for ListView.
|
|
|
|
|
you might try some other ListView event, such as MouseClick or MouseDown.
|
|
|
|
|
Damn! Forgot about those...
|
|
|
|
|
You can also simplify your code by rolling up all the handlers onto 1 sub
e.g.
Private Sub ControlsClicked() handles control1.click, control2.click, control3.click
UserHasClickedForm()
End Sub
Even if your controls do something in their own click events, both will fire.
You could even remove the additional sub and attach the handlers directly onto UserHasClickedForm()
|
|
|
|
|
Thanks everyone for your help.
Using Dave Kreskowiak's and Luc Pattyn's suggestions for looking at other ListView events, with daveauld's suggestion for simplifying the code, I've gone from my bloat-code which didn't work, to the following elegant-code which does.
Public Class MyForm
Private Sub UserHasClickedForm() Handles Me.Click, MyLabel.Click, MyListView.MouseDown, MyListView.ColumnClick, MyButton.Click
MyLabel.Text="Clicked"
End Sub
End Class
- The MouseDown event is raised if you click in a blank area or Item of the ListView control, but not if you click on a column header if the View property of the ListView is set to Details.
- The ColumnClick event is required to handle clicks on the column headers.
Thanks again.
Paul
|
|
|
|
|
hi,
How to convert open office document to pdf in vb 6.0??
i think easily convert ms word to pdf format. but open office is very complex for conversion.
please give me the solution....
thx in advance..
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
|
|
|
|
|
hi,
i got a solution for this conversion...
its take lot of time...
Sub SaveAsPDF_demo()
Dim oSM, oDesk, oDoc As Object 'OOo objects
Dim OpenParam(1) As Object 'Parameters to open the doc
Dim SaveParam(1) As Object 'Parameters to save the doc
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
Set OpenParam(0) = MakePropertyValue("Hidden", True) ' Open the file hidden
Set oDoc = oDesk.loadComponentFromURL("file:///C:/tmp/testdoc.odt", "_blank", 0, OpenParam())
Set SaveParam(0) = MakePropertyValue("FilterName", "writer_pdf_Export")
Call oDoc.storeToURL("file:///C:/tmp/testdoc.pdf", SaveParam())
Set oDesk = Nothing
Set oSM = Nothing
End Sub
Public Function MakePropertyValue(cName, uValue) As Object
Dim oStruct, oServiceManager as Object
Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
Set oStruct = oServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
oStruct.Name = cName
oStruct.Value = uValue
Set MakePropertyValue = oStruct
End Function
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
modified on Thursday, January 7, 2010 8:20 AM
|
|
|
|
|
In web forms - Is it possible to hide (visible=false) a complete row of controls with 1 command? And can this be controlled from code-behind? If so, pleasee show example...
Thanks in advance...
Chuck...
|
|
|
|
|
Ask this question in the ASP.NET forum.
|
|
|
|
|
I'm looking for a way to monitor drive activity using Visual Basic 2008. I want to create a small utility to simulate an LED in the system tray for drive read/write activity. I've found several such utilities that do this, but they all lack one thing or another, or they are over bloated with stuff I don't want or need, etc. I want to write my own so it will be like I want it. To get started, I need to know how to monitor drive activity. Can anyone point me in the right direction?
Blessings
RevEd
|
|
|
|
|
You'd need a device driver (.dll) that runs in Ring 0 that intercepts all I/O calls to do this. You cannot write this part in VB.NET. It MUST be done in C++ or some other unmanaged language.
|
|
|
|
|
You could look into ETW (Event Tracing for Windows)which is used to trace
Kernel/System events (XP or higher) and comes with a high performance
provider to (Kernel) Disk IO tracing. MSDN[^]
However, any docs I have looked at are targetted at a C++ audience like Dave said above...
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
|
Here's the answer: From bdbodger at MSDN (and also Dmitry Vitkovsky here at the Code Project)
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/62900f1e-1969-49bb-92cd-4c4eb8c7456d/?prof=required
Create a form and add 2 PerformanceCounter controls . For the first one set Catagory property to LogicalDisk , CounterName to Disk Read Bytes/sec , InstanceName to _Total for the second PerformanceCounter set CounterName to Disk Write Bytes/sec and the other values the same as the first PerformanceCounter . You will need to create 4 small images that you will use with a notifyIcon and add them to your resources such as these
<some graphics shown here>
Set the form WindowState property to Minimized and the ShowInTaskbar property to false . Add a timer set it's enabled property to true , interval 100 and add a NotifyIcon . Then try this code
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim both As Integer = 0
If (PerformanceCounter1.NextValue > 0) Then
both += 1
End If
If (PerformanceCounter2.NextValue > 0) Then
both += 2
End If
Select Case both
Case 0
NotifyIcon1.Icon = My.Resources.blue
Case 1
NotifyIcon1.Icon = My.Resources.green
Case 2
NotifyIcon1.Icon = My.Resources.green2
Case 3
NotifyIcon1.Icon = My.Resources.greengreen
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NotifyIcon1.Icon = My.Resources.blue
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles
NotifyIcon1.MouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
NotifyIcon1.Visible = False
Application.Exit()
End If
End Sub
End Class
____________________________________________________________________________________________
Change InstanceName to monitor a particular disk drive .
Blessings
RevEd
|
|
|
|
|
Hi,
I am facing a critical problem with office version. I am not sure but this happening in my side.
I have developed a vb.net application of outlook add-in which integrate with outlook. Using this i am syncing contact from server and add onto outlook.
I am using ms access as a back end for saving contact information also. I have a Boolean fields in ms access table. My application is working fine. but in some OS Version and Office Version it is updating some contact automatically. I run my application in following OS with Office version which is given in Table below.
The Third column is my output in different machine. I am not updating contact but in window 7 and office 2007 this is doing automatically. First 3 rows is working fine according to my logic. but 4rth row is showing wrong output.
OS Version, Office Version , Boolean Fields Update Automatically.
Window XP, 2003, No
Window XP, 2007, NO
Window 7, 2003, No
Window 7, 2007, Yes
Please guide me where i am wrong and what i need to do.
Regards
Dharmchand Dhingra
|
|
|
|