|
I know the feeling; i to started back at VB3, as a hobby for small home apps.
The jump to .Net is not that much of a culture shock. I would recommend you at leastdownload the free versions from microsoft and give it a go. It won't be long before you wont want to go back to VB6!
go on, be brave
Cheers,
|
|
|
|
|
|
I think the "newPicBox.BringToFront()" should be newPicBox.zorder as it is being done at runtime - not design time?
|
|
|
|
|
How can i generate bar code of 128 using vb6. i require free control (not trial) for it. help please
Tufail
|
|
|
|
|
Given that VB6 has been obsolete for a long time, why are you using it ? I doubt very much that anyone is still creating VB6 components, or supporting them.
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.
|
|
|
|
|
Goto wikipedia, search Barcode 128, then select Code 128; there is a link to an open source generator with code, for c++, vb.
I haven't tried the link, or had a look at whats there. surely you can manage to do that yourself.
also google throws up heaps of things, go looooooooook!
|
|
|
|
|
Hi All,
I am trying to implement the following problem in VB with SQL Database:
1) Added a client "R1" in SQL database
2) under "R1", I have to add "R2" - i.e. "R2" client is referred by "R1".
3) similarly "R3" has to be added under "R2"
4) similarly "R4" has to be added under "R3"
So my multilevel Tree structure would be like this : R1 -> R2 -> R3 -> R4
Now how to work on Database to search and add all the clients under their respective referrals.
I am not able to present the problem clearly, but I want to implement a Tree like architecture while programming in VB. I have all the client details in my database.
If anyone can throw some light on this,or provide some reference for programming this kind of architecture, then it would be highly appreciated.
Thanks
R.
|
|
|
|
|
One way to look at this is as follows:
setup the table like:
KeyID Integer
ParentID Integer
Name Character
The data would be stored as:
KeyID ParentID Name
100 0 Acme Major Headquarters
200 100 Acme Northeast Division
300 200 Acme New York Office
400 100 Acme Southern Division
The important factor is that the field, ParentID, is set to zero indicating that this is the top-level customer record. You can then see that all the direct children of "Acme Major Headquarters" have a ParentID of 100.
Hope this helps.
|
|
|
|
|
How can I programmatically select a value in a datagridviewcomboboxcolumn?
I am filling the combobox with values from a datatable, but I'd like to be able to programmatically select a value in the combo depending on other cell value(s) in the row.
Not sure what I am missing, should be a fairly simple task.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
modified on Friday, October 30, 2009 11:49 AM
|
|
|
|
|
I have this string in ComboBox "10a, 10b, 1a, 1b, 1c, 2a, 2b ....." I want to sort but not work corectly. Not sort 1a, 1b, 1c, 2a, 2b,10, 10b and sort 10a, 10b, 1a, 1b, 1c, 2a, 2b
|
|
|
|
|
You can get the "logical sort order" by using P/Invoke and the same code Windows Explorer does for sorting file names. I only have a C# snippet:
private class LP_StringComparerLogical : IComparer<string> {
public int Compare(string s1, string s2) {
if (s1!=null && s2!=null) return StrCmpLogicalW(s1, s2);
else return string.Compare(s1, s2, true);
}
}
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
private static extern int StrCmpLogicalW(string s1, string s2);
The prototype (see last 2 lines) probably looks like this in VB.NET:
Declare Unicode StrCmpLogicalW Lib "shlwapi.dll" (s1 As String, s2 As String)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
modified on Thursday, October 29, 2009 3:37 PM
|
|
|
|
|
How to set DateTimePicker date one month later
|
|
|
|
|
It depends on what you mean, one month later than what?
If you mean one month from another DateTimePicker then
Me.DateTimePicker2.Value = Me.DateTimePicker1.Value.AddMonths(1)
If you mean from todays date then
Me.DateTimePicker1.Value = Me.DateTimePicker1.Value.AddMonths(1)
If that doesn't get you there, please be a little more specific.
Thanks
|
|
|
|
|
|
A wild, adventurous, and untested guess: dateTimePicker.Value=dateTimePicker.Value.AddMonths(1)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc Pattyn wrote: A wild, adventurous,
Stop living dangerously!
|
|
|
|
|
why?
adding a meesage to the VB forum always is an adventure, you never know what the outcome will be.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
You don't have to go as far as adding a message........just visiting the VB Forum is a wild adventure, the savage beast that is a poorly asked question is always lurking in the shadows, just waiting to jump out, to be rapidly shot down by quick CG response
|
|
|
|
|
Hello all!
So I'm having a little problem refreshing dynamic buttons on a form. I'm slowly making progress, but I want to make sure I'm doing it the right way, or maybe there is a better way. So here is some code.
So this gets the data from the database so we know what buttons to load, etc,
Private Function GetButtonData() As List(Of ButtonInfo)
Dim constr As New SqlConnection(PVDBConn)
'Dim PVDBConn As New SqlConnection("")
'cmdUpd = New SqlCommand("SelVisName", constr)
cmdUpd.CommandType = CommandType.StoredProcedure
Dim lst As New List(Of ButtonInfo)
Dim da As New SqlDataAdapter("SELECT VisId, VisName, VisEnabled, VisFlag, visPort, VisCpuName FROM tblVis ORDER BY VisId", constr)
Dim t As New DataTable
Try
constr.Open()
'PVDBConn.Open()
da.Fill(t)
For Each r As DataRow In t.Rows
lst.Add(New ButtonInfo(CInt(r("VisId")), CStr(r("VisName")), CBool(r("VisEnabled")), CBool(r("VisFlag")), CStr(r("VisPort")), CStr(r("VisCpuName"))))
Next
Here is the code that will load the buttons on the form. I have this procedure in the OnLoad event of the form. This is the first form and the main form of the program.
Private Sub GetButtonOnScreen()
GetButtonData()
Buttons = GetButtonData()
For Each bi As ButtonInfo In Buttons
If bi.Enabled Then
'Dim prtLabel As New Label,
' MsgBox(prtLabel.Text.ToString)
Dim newbutton As New Button
'this is were it determines the color is red or blue
If bi.HasChanges Then
newbutton.Image = My.Resources.pvmetal2red
Else
newbutton.Image = My.Resources.pvmetal3
End If
newbutton.Text = bi.VisText
Dim MinFont As New Font("arial", 12, FontStyle.Bold)
newbutton.Font = MinFont
newbutton.TextAlign = ContentAlignment.MiddleCenter
newbutton.Tag = bi
newbutton.Width = 102
newbutton.Height = 42
newbutton.BackColor = Color.AliceBlue
'Plus 80 for Top
newbutton.Top = 80 '+ (0 + bi.VisId)
newbutton.Left = -95 + (100 * bi.VisId)
If newbutton.Left >= 906 Then
' newbutton.Top = 160 '+ '(0 + bi.VisId)
newbutton.Top = 180
newbutton.Left = -1095 + (100 * bi.VisId)
' MsgBox(newbutton.Location.ToString)
End If
If newbutton.Left >= 906 Then
'newbutton.Top = 240 '+' (0 + bi.VisId)
newbutton.Top = 280
newbutton.Left = -2095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 380 '+ '(0 + bi.VisId)
newbutton.Left = -3095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 480 '+ (0 + bi.VisId)
newbutton.Left = -4095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 580 '+ (0 + bi.VisId)
newbutton.Left = -5095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 680 '+ (0 + bi.VisId)
newbutton.Left = -6095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 780 '+ (0 + bi.VisId)
newbutton.Left = -7095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 880 '+ (0 + bi.VisId)
newbutton.Left = -8095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 980 '+ (0 + bi.VisId)
newbutton.Left = -9095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 1080 '+ (0 + bi.VisId)
newbutton.Left = -10095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 1180 '+ (0 + bi.VisId)
newbutton.Left = -11095 + (100 * bi.VisId)
End If
newbutton.Name = bi.VisId.ToString
' newbutton.Tag = bi.PortId.ToString
AddHandler newbutton.Click, AddressOf Buttons_Click
Me.Controls.Add(newbutton)
End If
Next
End Sub
So I have a procedure written to refresh the buttons. Not sure if this is the best way.
GetButtonData()
Buttons = GetButtonData()
For Each bi As ButtonInfo In Buttons
If bi.Enabled Then
Dim newbutton As New Button
newbutton.Text = bi.VisText
Dim MinFont As New Font("arial", 12, FontStyle.Bold)
newbutton.Font = MinFont
newbutton.TextAlign = ContentAlignment.MiddleCenter
newbutton.Tag = bi
newbutton.Width = 102
newbutton.Height = 42
newbutton.BackColor = Color.AliceBlue
newbutton.Name = bi.VisId.ToString
If bi.HasChanges Then
'' newbutton.Image = My.Resources.pvmetal2red
''' newbutton.BackColor = Color.Gray
'''' newbutton.ForeColor = Color.DarkOrange
''''''' newbutton.Image = My.Resources.pvmetal3
chString = bi.VisId
Else
'''''''' newbutton.Image = My.Resources.pvmetal3
End If
Dim con As Control
For Each con In Me.Controls
If con.Name = chString Then
Me.Controls.Remove(con)
Me.Controls.Add(con)
End If
Next
'Plus 80 for Top
newbutton.Top = 80 '+ (0 + bi.VisId)
newbutton.Left = -95 + (100 * bi.VisId)
If newbutton.Left >= 906 Then
' newbutton.Top = 160 '+ '(0 + bi.VisId)
newbutton.Top = 180
newbutton.Left = -1095 + (100 * bi.VisId)
' MsgBox(newbutton.Location.ToString)
End If
If newbutton.Left >= 906 Then
'newbutton.Top = 240 '+' (0 + bi.VisId)
newbutton.Top = 280
newbutton.Left = -2095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 380 '+ '(0 + bi.VisId)
newbutton.Left = -3095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 480 '+ (0 + bi.VisId)
newbutton.Left = -4095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 580 '+ (0 + bi.VisId)
newbutton.Left = -5095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 680 '+ (0 + bi.VisId)
newbutton.Left = -6095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 780 '+ (0 + bi.VisId)
newbutton.Left = -7095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 880 '+ (0 + bi.VisId)
newbutton.Left = -8095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 980 '+ (0 + bi.VisId)
newbutton.Left = -9095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 1080 '+ (0 + bi.VisId)
newbutton.Left = -10095 + (100 * bi.VisId)
End If
If newbutton.Left >= 906 Then
newbutton.Top = 1180 '+ (0 + bi.VisId)
newbutton.Left = -11095 + (100 * bi.VisId)
End If
'''''''''''' newbutton.Name = bi.VisId.ToString
AddHandler newbutton.Click, AddressOf Buttons_Click
'''Me.Controls.Add(newbutton)
End If
Next
I have to remove the buttons, then add them back in.
Thanks for the help!
Rudy
|
|
|
|
|
You using the button_id to determine the left position of your button...
Thats really cruel ... if I may say so.
On the other hand you can do your "If newbutton.Left >= 906 Then" in a loop, but I think
you should have a break and think about what way you should choose to determine the left position.
[edit]
I meant left position not top.
[/edit]
modified on Thursday, October 29, 2009 11:11 AM
|
|
|
|
|
Ouch... Ok, let me try to understand this...
You have a series of buttons defined in your database, and you're trying to lay them out in a left-to-right, top-to-bottom format...
I think you need to come at this from a different angle. Let's set aside the actual coordinates for a second, and think of how you want to lay it out.
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
Something this simple has to have a pattern, and that's what algorithms are all about.
Now, if you're doing this in a static grid (As in all the controls are the same size, and all of the rows have the same number of controls), this becomes REALLY simple. Instead of using the "visid" to calculate the "Left", use it to figure out what row and column you're in.
Row Number = ID / Number of Controls in Row, rounded down
Column Number = ID Mod Number of Controls in Row
(Mod = modulus operator. A Mod B = Remainder when calculating A/B)
Example, using above grid:
ID = 17
Column Count (Number of controls in row) = 10
Row number = 17 / 10 = 1.7, rounded down to 1 -- Row 1 (Second row, since first is zero)
Column number = 17 Mod 10 = 7 -- Column 7 (8th column)
See where I'm going with this?
|
|
|
|
|
Hi Guys!
Wow! I wasn't even thinking that was my problem. But I'll do anything to make it better.
So Ian, ID=17 refers to how many rows I will have. In my database, I have an ENABLED column. So if there is a TRUE value, than the button will be built. Your right about the layout, that's exactly how I will have it. But I also need to have it so if button 23, 24, 25 is not loaded, there will be a empty space there. So each button is always locked to it's location, so if I want two groups, I can have 1 to 20 and then 40 to 60. And I have a big gap between 20 to 40.
Thanks for your help!
Rudy
|
|
|
|
|
Well, if you use the VisId field as the ID in the calculation I posted, that's exactly what you'll get.
Of course, if your buttons start at 1, you might want to subtract 1 so it starts at the top-left corner. Since the formulas are based on the ID, and not just counting through as they go, any missing IDs will cause it to skip a spot.
|
|
|
|
|
Thanks Ian! I'll give it a shot. May have to bug you if I get stuck writing out the code.
Thanks again!
Rudy
|
|
|
|
|
hi
in c language we use ellipses for unlimited no of arguments in a function
similarly what we can use in vb.net
|
|
|
|
|