|
I understand what you are saying about Visual Basic regarding the GUI apps they have, I am aware of that. However visual c uses .cpp files and when i open them in visual studio I Cannot create any GUI as I don't think it is compatible with it. So as a result I have decided that I am going to use Visual Basic for my project. With regards to your question about the motor, I honestly don't know what currents are needed as I am part of the software team, I only know that it is a general purpose motor which is 3V DC. Can you send me the link with the LED example as this might help me in implementing my project
|
|
|
|
|
Here is a good article about the subject at the community.
http://www.codeproject.com/KB/cs/cspplcds.aspx
Sigurd Johansen
|
|
|
|
|
Hi,
compare data in two database objects into list1 want to, Can you help me fix my errors in the code?
Dim CON1 As New ADODB.Connection
Dim CON2 As New ADODB.Connection
Dim kayit1tablo As New ADODB.Recordset
Dim kayit2tablo As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Private Sub cmdKayitGoster_Click()
On Error Resume Next
Dim i, k, bulunan
aranan1 = CON1.Open & App.Path & "\a.mdb"
aranan2 = CON2.Open & App.Path & "\b.mdb"
rs1.Open "Select * from Master where veri1=" & Val(aranan1), CON1, adOpenKeyset, adLockOptimistic
rs2.Open "Select * from master where veri2=" & Val(aranan2), CON2, adOpenKeyset, adLockOptimistic
For k = 0 To rs1.RecordCount - 1
bulunan = "0"
For i = 0 To rs2.RecordCount - 1
bulunan = "1"
End If
Next
If rs1.RecordCount(k) = rs2.RecordCount(i) Then
Else
List2.AddItem rs(veri1)
End If
Next
End Sub
Private Sub Form_Load()
Set CON1 = New ADODB.Connection
Set CON2 = New ADODB.Connection
CON1.Open "Provider=Microsoft.jet.oledb.4.0; Data Source=" & App.Path & "\a.mdb"
CON2.Open "Provider=Microsoft.jet.oledb.4.0; Data Source=" &
App.Path & "\b.mdb"
kayit1tablo.Open "Select * from Master", CON1, adOpenKeyset, adLockOptimistic
kayit2tablo.Open "Select * from Master", CON2, adOpenKeyset, adLockOptimistic
End Sub
|
|
|
|
|
You can have another selection
rs3.Open "Select * from master where veri1<>veri2, CON2, adOpenKeyset, adLockOptimistic
For u = 0 To rs3.RecordCount - 1
List2.AddItem rs3(veri1)
Next
Something, like the above...
|
|
|
|
|
Hi and thanks for looking at my question(s). I took VB (using VS 2008) last year and haven't looked at it since and would like to try and apply a little bit of what I learned.
I want to read a zip file, unzip and copy the folders into a particular directory structure.
If the parent folder already exists, I want to only copy in the sub folders. If the sub folders exist I want to exit the application.
Thank you again for looking.
Danny
|
|
|
|
|
|
|
Is there a way that a component array can be created in vb.net like in vb6? For example if I need to create a button Array? Any examples? I am looking to shorten the code below.
Menuitem1.Text = item(0).menuitem
MenuItem2.Text = item(1).menuitem
MenuItem3.Text = item(2).menuitem
MenuItem4.Text = item(3).menuitem
MenuItem5.Text = item(4).menuitem
MenuItem6.Text = item(5).menuitem
MenuItem7.Text = item(6).menuitem
MenuItem8.Text = item(7).menuitem
MenuItem9.Text = item(8).menuitem
MenuItem10.Text = item(9).menuitem
MenuItem11.Text = item(10).menuitem
|
|
|
|
|
You can either create a List(Of TextBox) and put your controls in the list, or you can put your MenuItem TextBoxes in a separate panel and iterate through the controls on the panel.
|
|
|
|
|
You can Create a Array of Component. Bydefault it is not possible.but You can use a function to create no. of Components to create. The main thing is that you should dispose every component. Else it will be generate error.
If you can think then I Can.
|
|
|
|
|
I'm trying to do a mapping exercise and if a user clicks on a column and it has already been mapped, I want to check the corresponding radio button. If I use a For Each loop to loop through the controls of a group box, I can find the control/radio button, I can change the Text, Font size, position and many other things, but I cannot change the Checked status. What am I missing?
Thanks in advance,
Steve
|
|
|
|
|
AFAIK you can get and set RadioButton.Checked; setting it might fail if it is disabled.
And then there is RadioButton.PerformClick()
|
|
|
|
|
AFAIK?
Was able to get to the Checked property by converting the Control to a Radio Button using CType.
Private Sub ChecktheRadioButton(ByVal sName as String)
Dim ctr as Control
For Each ctr in GroupBox2.Controls
If ctr.Name = sName then
CType(ctr,RadioButton).Checked = True
Exit Sub
Next
End Sub
|
|
|
|
|
See, there is no problem whatsoever. Of course it has to be a Control that HAS a Checked property.
Now try this:
CType(GroupBox2.Controls(theNameOfMyTargetRadioButton),RadioButton).PerformClick()
|
|
|
|
|
Beautiful. That did the trick.
But still a bit confused - what is AFAIK
|
|
|
|
|
|
All of us must have come across the fact that some set of codes are specific to a particular OS only and incompatible with others. In some instances they may also lead to system crashes.
In such cases we need to track and identify the OS first and then proceed accordingly. So, here is how you can write a program in VB6.0 that can run in different Windows operating systems.
http://www.mindfiresolutions.com/Determining-host-operating-system-using-VB-6-189.php
Cheers,
Eliza
|
|
|
|
|
All very nice, but if you have to go back to the dark ages with VB6 then you should also handle windows millenium edition, windows 98, possibly windows 95 and variants of NT.
If this is to be of any use going forward you also need to support Windows 7.
Nowhere do you cover the server editions, which is an absolute must!
Plus of course you can get all this out of the box with .Net, and seeing as vb6 is definately a legacy language now, why bother.
|
|
|
|
|
NIce and all, but VB6 is a dead language and you're about 15 years too late to the party with this. The forums is also not the place to post such snippets. Post this in Tips/Tricks instead.
|
|
|
|
|
You can use "winmgmts" like this:
Private Sub Form_Load()<br />
strComputer = "."<br />
Set objWMIService = GetObject("winmgmts:" _<br />
& "{impersonationLevel=impersonate}!\\" _<br />
& strComputer & "\root\cimv2")<br />
Set colSettings = objWMIService.ExecQuery _<br />
("Select * from Win32_OperatingSystem")<br />
For Each objOperatingSystem In colSettings <br />
Label1.Caption = objOperatingSystem.Name<br />
Next<br />
End Sub
More properties in: http://msdn.microsoft.com/en-us/library/aa394239(VS.85).aspx
Hope be helpful
|
|
|
|
|
each time I run the follow code I get a runtime error.
Public Class menuitems
Public menuitem As String
Public itemcost As Double
End Class
'Dim totalorderquantity(12) as Integer
Public Class frmtodayscafe
Inherits System.Windows.Forms.Form
Public dr As DataRow
Public item() As menuitems
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fileNamex As String = "menu1.txt"
Dim dirName As String = _
Path.GetDirectoryName(Application.ExecutablePath)
Dim dt As DataTable
Dim adapter1 As New OleDbDataAdapter
Using cn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" & _
"Data Source=" & dirName & ";" & _
"Extended Properties=""Text;HDR=Yes;FMT=Delimited""")
' Open the connection
cn.Open()
' Set up the adapter
Using adapter As New OleDbDataAdapter( _
"SELECT * FROM " & fileNamex, cn)
dt = New DataTable("menuitems")
adapter.Fill(dt)
End Using
End Using
Redim item(dt.Rows.Count() - 1)
Dim drcounter As Integer = 0
For Each dr As datarow In dt.Rows
Debug.Print("{0} {1}", _
dr("Menu Items"), _
dr("Item Cost"))
item(drcounter).menuitem = dr("Menu Items").ToString
item(drcounter).itemcost = dr("Item Cost").ToString
drcounter += 1
Next
the run time error is Object reference not set to an instance of an object.
modified on Friday, March 19, 2010 6:50 PM
|
|
|
|
|
you never set the bounds on item() .
you need a
ReDim Preserve item(drcounter)
...or you could just do
Redim item(dt.Rows.Count() - 1)
|
|
|
|
|
Thanks, It worked. I used
Redim item(dt.Rows.Count() - 1)
to resolve issue after reading the data table.
|
|
|
|
|
glad it worked. Most of the time, we just need a separate set of eyes on our code. I can't tell you how many times I've gotten errors because I forgot a simple line of code.
|
|
|
|
|
compile-time errors and run-time exceptions tend to provide line numbers (assuming a debug build), so you should be able to easily find where the problem occurs, and then deduce where it originated.
|
|
|
|