|
all it takes is for you to understand how it works (see documentation and my example), then write code accordingly in the language of your choice.
And why did you modify the SQL-like statement in the ManagementObjectSearcher?
I will no longer hold your hand, please learn to help yourself.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
that is the problem i don't understand c code. I am just about alright with vb.net code however i was trying to use you r code which u kindly wrote but i really haven't got a clue to writting it in vb.net. The only reason that i had to change the managemt SQL into "serialnumber Win32_BIOS" was because it didn't like "serialnumber" from "win32_BIOS"
I thank you for your work however i don't know c so would you be able to help me transfer it to vb.net?
many thanks
|
|
|
|
|
That's because it's not supposed to be in blue at all. That SELECT statement was supposed to be specified in the parameters of the objectsearcher class, not as a stand-alone statement. When I told you to look at the example in the link that I gave you, I would have thought that is was very obvious where that statement goes. I mean, in the example, there is a statement almost exactly like it.
|
|
|
|
|
offroaderdan wrote: Dim SerialNumber As New Management.ManagementObjectSearcher("serialnumber Win32_BIOS")
should be
Dim SerialNumber As New Management.ManagementObjectSearcher("SELECT SerialNumer from Win32_BIOS")
Then you can get rid of the contents of that loop and replace them with some simple code to display result 's SerialNumber property.
|
|
|
|
|
awsome thanks 0x3xc0
works now
|
|
|
|
|
I want to filter datagridview using 2 textboxes which filters the DGV according to the values entered in them. For example:
Suppose i have following dgv and
There is nametextbox where i type in "V" and i get following results.
Name Mobile
----- ------
Vikki 9861054321
Vinni 9546743243
Valter 3211243 etc...
Now i type into mobiletextbox "9" and i get following results:
Name Mobile
----- ------
Vikki 9861054321
Vinni 9546743243
and when i type "5" i.e. it becomes "95" and then i get following results :
Name Mobile
----- ------
Vinni 9546743243
For which i pass the following code in the text change event of both textboxes:
ClientProfileBindingSource.Filter = String.Format("Name LIKE '{0}%' AND Mobile LIKE '{1}%'", NameTextBox.Text, MobileTextBox.Text)
But this aint giving me results.. any thoughts on this?
|
|
|
|
|
Hi,
I have added an unbound checkbox column to my DGV. I have two questions on handling it:
1. How to have a checkbox on this Column header, which on checking must check all the rows in the DGV and vice versa?
2. How do i know what rows are selected?
Please help.
|
|
|
|
|
Take a look at this[^], from a quick look it seems to solve both your questions. It is in C#, unfortunately, but the syntax is sufficiently close to VB that you might well be able to understand it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi
I am passing the following code to insert values in my DB table directly:
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
Using connection As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ProjectMW\MachineWale\MachineWale\DatabaseMW.mdf;Integrated Security=True;User Instance=True")
Using command As New SqlClient.SqlCommand("INSERT INTO [MachineProfile] ([MachineID], [Category], [Type], [Brand], [Model], [Quantity], [SalePrice], [RentalRate], [ListingDate], [Agent], [Availability], [PurchaseDate], [Kmsrun], [HoursRun], [ChasisNo], [EngineNo], [OtherSpec], [WebEntry], [Ownership]) VALUES (@MachineID, @Category, @Type, @Brand, @Model, @Quantity, @SalePrice, @RentalRate, @ListingDate, @Agent, @Availability, @PurchaseDate, @Kmsrun, @HoursRun, @ChasisNo, @EngineNo, @OtherSpec, @WebEntry, @Ownership) where [MachineID] = '" & TextBox1.Text & "'", connection)
command.Parameters.AddWithValue("@MachineID", TextBox1.Text)
command.Parameters.AddWithValue("@Category", ComboBox2.Text)
command.Parameters.AddWithValue("@kmsrun", TextBox10.Text)
command.Parameters.AddWithValue("@Type", ComboBox3.Text)
command.Parameters.AddWithValue("@Brand", ComboBox7.Text)
command.Parameters.AddWithValue("@Model", ComboBox8.Text)
command.Parameters.AddWithValue("@Quantity", TextBox7.Text)
command.Parameters.AddWithValue("@SalePrice", TextBox17.Text)
command.Parameters.AddWithValue("@RentalRate", TextBox18.Text)
command.Parameters.AddWithValue("@ListingDate", TextBox19.Text)
command.Parameters.AddWithValue("@Agent", ComboBox6.Text)
command.Parameters.AddWithValue("@Availability", ComboBox4.Text)
command.Parameters.AddWithValue("@PurchaseDate", DateTimePicker1.Value)
command.Parameters.AddWithValue("@HoursRun", TextBox11.Text)
command.Parameters.AddWithValue("@ChasisNo", TextBox12.Text)
command.Parameters.AddWithValue("@EngineNo", TextBox13.Text)
command.Parameters.AddWithValue("@OtherSpec", TextBox15.Text)
command.Parameters.AddWithValue("@WebEntry", ComboBox5.Text)
command.Parameters.AddWithValue("@Ownership", ComboBox1.Text)
connection.Open()
command.ExecuteNonQuery()
MsgBox("Updated")
End Using
End Using
End Sub
But i am getting this error after executing as:
Incorrect syntax near the keyword 'where'.
What could be possibly wrong?
LuxCoder
|
|
|
|
|
Try changing your command to:
Using command As New SqlClient.SqlCommand("INSERT INTO [MachineProfile] ([MachineID], [Category], [Type], [Brand], [Model], [Quantity],
[SalePrice], [RentalRate], [ListingDate], [Agent], [Availability], [PurchaseDate], [Kmsrun], [HoursRun], [ChasisNo], [EngineNo], [OtherSpec], [WebEntry],
[Ownership]) VALUES (@MachineID, @Category, @Type, @Brand, @Model, @Quantity, @SalePrice, @RentalRate, @ListingDate, @Agent, @Availability, @PurchaseDate,
@Kmsrun, @HoursRun, @ChasisNo, @EngineNo, @OtherSpec, @WebEntry, @Ownership) where [MachineID] = <big>@MachineID</big>", connection)
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
AFAIK an INSERT statement does not take a WHERE clause. New records just get added to a table.
Ref.[^]
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Well the intention is to edit an existing datarow populated on my form where the Primary key is the textbox.text....
|
|
|
|
|
You should buy a book on SQL perhaps.
The update command appears to be what you want. You do realise that putting your sql in your presentation code makes for an unmaintainable mess, right ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Can you give me an example of Update command?
|
|
|
|
|
okay thanks i got it. Update command is working now
|
|
|
|
|
Hello.
I am currently developing an application that uses the component MapWinGIS, I managed to make a zoom on the map, move, etc. ...
My current problem is that I do not know how to handle the event click on the map control: click on an object (eg a town) to display information from the latter.
Thank you in advance for your prompt replies.
|
|
|
|
|
|
I looked but I could not find. Could you elaborate?
|
|
|
|
|
|
http://users.telenet.be/voorbeeld/vb.JPG[^]
how can i create somthing like this in visual studio 2008
i don't find nothing for doing this like the exampel and i don't want to use 100's off button's any help or direction
T'hanks
|
|
|
|
|
I am not going to follow a link from someone I do not know. This is no reflection on you, just a rule I have.
Therefore can you describe what you are trying to do?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
i try to explain
you have 14 Squares with 42 numbers in it
you can select 6 numbers at eatch Square
if you do this with buttons you have 588 this is big
is there a other way to do this
t'hanks
|
|
|
|
|
As Luc has said below, I would simply draw lines to represent the squares and use the Graphics.DrawString() method to 'paint' the numbers in each square.
Again, as Luc has said, you could use a Panel and add the code to do the above to the Paint event handler of the Panel .
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Things like that I create by code, and not through Visual Designer.
So get a Panel, and add stuff to its Paint handler for drawing the squares and the numbers.
Decide on a data structure to keep track of the numbers you want marked.
Good luck with our lottery!
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hello,
I have 15 textboxes ( textbox1 => textbox15).
After calculating the values, i want to clear them with a single press on a button:
I tried:
For Each ctl As Control In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
but it won't work. What am I doing wrong?
Thanks in advance
Luc
|
|
|
|
|