|
You don't use a command prompt to do this. Use the Process class[^] to launch the same command you would type at that prompt to do it without the prompt.
|
|
|
|
|
I have a DataGridView whos datasource is a bindingSource. I wish to filter the DataGridView via a comboBox, with a button to instigate the whole thing. So I have:
Private sub selectionButton_Click(ByVal sender as system object, byVal e as system.eventargs) handles selectionButton.click
transactionBindingSource.filter = String.format("TranType = '{0}'", itemSelectionComboBox.text)
End Sub
But although tracing the code shows that the filter is correctly selected, my DataGridView does not reflect the filtering selected.
What am I doing wrong please?
|
|
|
|
|
You need to rebind the data source
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Well, I originally thought that too Bob, and tried adding:
transactionDataGridView.DataSource = nothing<br />
transactionDataGridView.DataSource = transactionBindingSource
without success
|
|
|
|
|
I think you have to make the underlying source a view. This is the code from VS help
Private Sub PopulateDataViewAndFilter()
Dim set1 As New DataSet()
' Some xml data to populate the DataSet with.
Dim musicXml As String = " & _
"<music>" & _
"<recording><artist>Coldplay</artist><cd>X & Y</cd></recording>" & _
"<recording><artist>Dave Matthews</artist><cd>Under the Table and Dreaming</cd></recording>" & _
"</music>"
' Read the xml.
Dim reader As New StringReader(musicXml)
set1.ReadXml(reader)
' Get a DataView of the table contained in the dataset.
Dim tables As DataTableCollection = set1.Tables
Dim view1 As New DataView(tables(0))
' Create a DataGridView control and add it to the form.
Dim datagridview1 As New DataGridView()
datagridview1.AutoGenerateColumns = True
Me.Controls.Add(datagridview1)
' Create a BindingSource and set its DataSource property to
' the DataView.
Dim source1 As New BindingSource()
source1.DataSource = view1
' Set the data source for the DataGridView.
datagridview1.DataSource = source1
source1.Filter = "artist = 'Dave Matthews'"
End Sub
(I chopped some of the xml out, so I may have been over enthusiastic and chopped too much!)
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
|
hii all..
im beginner in using VB..how can i validate the hex input in a textbox..
plss help me..
|
|
|
|
|
You can use ReguarExpression to validate the text. All you need is a regular expression that checks if the input contains A-F(both case) and 0-9 and nothing else. You can do this in Validating event or TextChanged event.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
modified on Friday, January 30, 2009 12:27 AM
|
|
|
|
|
|
Thanks for pointing out. Corrected.
I had mixed octal and hexadecimal.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
hii!..look at this one.
Function StringToHex(ByVal text As String) As String
Dim hex As String
For i As Integer = 0 To text.Length - 1
hex &= Asc(text.Substring(i, 1)).ToString("x").ToUpper
Next
Return hex
End Function
null referrence exception occured..why?..
plss help me..
|
|
|
|
|
The only reason that would happen is if you send a null reference (Nothing in VB) to the method.
You are not initialising the hex variable to a string, so it's Nothing from the start, but eventhough that is not recommended (you get a compiler warning about it), it doesn't cause an exception.
Alos, you should use a StringBuilder to build a string. Using the &= operator in a loop scales very badly.
|
|
|
|
|
Can I make my combobox object only for read
|
|
|
|
|
What do yo mean by readonly? Is the user still able to open the list in combo but not able to select from that list?
|
|
|
|
|
I mean that don't write the text area in combobox but I understand how make that -Combobox-dropdownstyle make dropdownlist thanks
|
|
|
|
|
Yes exactly, that style is used to prevent the user to write to the text area.
|
|
|
|
|
Thank Mika in Your answers
|
|
|
|
|
Who of you VB.NET programmer is using linq and if you are could you share some things that you are using it for in the "real world".
Humble Programmer
|
|
|
|
|
|
Thanks for the reply, I know this may sound dumb but I am still unsure of how this can help me. We write software that uses a mySQL backend with stored procedures and some dynamically generated SQL. Can you give me a instance when it would be beneficial to use linq. The application just retrieves and displays info and lets the users update that info. One things that I thought sounded close to the explanation I have had of the use of linq, is to read a dataset in memory currently we are reading the xml file each time we need a setting for the app(I know that is very slow) this is a piece of code I did not write but have been wanting to find a better solution to for a while now. Another thought is it more efficient to read a large list of data in from the database and then search through with linq of write a huge ugly SQL statement to only get the rows I am needing.
Humble Programmer
|
|
|
|
|
I am creating a simple web browser in vb that I will be using to access a secured site. The browser works fine, but if I click on a link within the secured site the new window that pops up asks me to log in again, instead of automatically displaying the content. What do I need to do to tell the web browser control to pass my credintials on to any new windows that open?
|
|
|
|
|
Make sure the target of the link is set correctly. Probably needs to be _self.
|
|
|
|
|
Hi,
I am trying to access a Windows Xbox 360 from within VB.net 2008, I can find plenty of examples using C sharp (and the controller works fine) but nothing using VB.
Could anyone please show me how to capture any reading from an Xbox 360 controller and display it in say a label. I should be able to do the rest my self.
I do not want to write games as yet, I want to control ordiary windows form applications with xbox 360 controller in addition to KB, Mouse and Joystick. So hopefully won't need XNA.
Thanks,
Steve
|
|
|
|
|
Exactly the same way you do it in C#. Just use an online code conversion utility to help you convert the code.
|
|
|
|
|
What a good suggestion, I didn't know they existed. I used-
http://www.developerfusion.com/tools/convert/csharp-to-vb/
and came up with this
Imports Microsoft.Xna.Framework.Input
'references
'goto project-add references
'add all xna from .net tab
'go to project - properties -references tag
'under imported namespace check
'Microsoft.xna
'Microsoft.XnaFramework
'Microsoft.XnaFramework.Content
'Microsoft.XnaFramework.GameServices
'useful site for code conversion C to vb
'http://www.developerfusion.com/tools/convert/csharp-to-vb/
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim currentState As GamePadState = GamePad.GetState(PlayerIndex.One)
If currentState.IsConnected Then
If currentState.Buttons.A = ButtonState.Pressed Then
Label2.Text = "pressed"
Else
Label2.Text = "Released"
End If
Label1.Text = currentState.ThumbSticks.Left.X.ToString()
Else
MessageBox.Show("Controller is not connected")
Timer1.Enabled = False
End If
End Sub
End Class
Hope this helps someone.
Steve
|
|
|
|