|
You really can't. Why are you still using VB6 ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dreamer2007 wrote: How can I join these two applications without changing much of the code of the complete application?
You can't without merging the code together and making necessary changes. Why VB6? It is a dead language now.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi guys
i want to perform some operation based on the types of my objects which i send as
parameter,
but i want to get the type of this object at runtime using reflection and using select case but i am unable to do that , if else work fine but i want select case , thanks
like
'it works fine'
If t.GetType Is GetType(ExpenceVoucher) Then
Insert_ExpemseClaim(exp)
End If
'the following code gives compile time error'
Select Case exp
Case exp.GetType Is GetType(ExpenceVoucher)
End Select
any help, thanks in advance
hello
|
|
|
|
|
ghumman63 wrote: but i want to get the type of this object at runtime using reflection and using select case but i am unable to do that , if else work fine but i want select case
If you're thinking of doing this, you don't need to do it. This is a situation where you'd use an overloaded method.
ghumman63 wrote: 'the following code gives compile time error'
Select Case exp
Case exp.GetType Is GetType(ExpenceVoucher)
End Select
Select Case won't do this. You have to get the types BEFORE using them in the Select Case statements.
|
|
|
|
|
Just letting you know that select case can do it.
Select Case True
Case Me Is Nothing
Stop
Case IsNothing(Me)
Stop
Case TypeOf (Me) Is Form
Stop
End Select
|
|
|
|
|
I know it'll work. He just needs to rewrite his Case statements. I also hate getting the TypeOf over and over again until it finds the correct Case. I get it once, before the Select, then use then returned type in the rest of the code.
|
|
|
|
|
sorry - misunderstood your statement 'Select Case won't do this'.
question on a different subject. each control has an event "enabledchanged" is there a way to make this fire even if you give it the same value? Enabled=true / Enabled=true? Is there any other technique that can be done that doesn't envolve creating my own control wrapper to detect this?
Thanks for your time.
Nathan
|
|
|
|
|
nlarson11 wrote: each control has an event "enabledchanged" is there a way to make this fire even if you give it the same value? Enabled=true / Enabled=true?
No, it'll fire whenever the value actually changes.
nlarson11 wrote: Is there any other technique that can be done that doesn't envolve creating my own control wrapper to detect this?
Nope. You have to replace the Enabled property's Set method of the controls to get this to work. As it stands now, the Enable property code is this:
<DispId(-514), Localizable(True), SRCategory("CatBehavior"), SRDescription("ControlEnabledDescr")> _
Public Property Enabled As Boolean
Get
If Not Me.GetState(4) Then
Return False
End If
Return ((Me.ParentInternal Is Nothing) OrElse Me.ParentInternal.Enabled)
End Get
Set(ByVal value As Boolean)
Dim enabled As Boolean = Me.Enabled
Me.SetState(4, value)
If (enabled <> value) Then
If Not value Then
Me.SelectNextIfFocused
End If
Me.OnEnabledChanged(EventArgs.Empty)
End If
End Set
End Property
See the bolded If statement?? That's why the event won't fire if the value doesn't actually change. If the internal enabled variable is the same as the value passed in, the OnEnabledChanged method is never called, which is what raises the event.
Actually, the more I think about this, I'd ADD A NEW EVENT, possibly called EnabledSet , and raise it from the Set code in the Enabled property. I would NOT change the behavior of the existing EnabledChanged event.
|
|
|
|
|
|
I am working on SEO based project. In this project I need to find reciprocal website of other site. means here i need to find that the url site who wants to put their name on my site, then that site should also have my url address in thier site. so how can I find that whehter the requested site contains my url address or not. Please help me. Thanks in advance
|
|
|
|
|
|
He's posted the same thing in at least 4 forums.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Don't cross post. It is very rude.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
For a tableAdapter , vb.net usually create automatically the fill() function .But i want to create a fill(parameter1) function where parameter1 is a value that filter data (by a filed ) filled into dataset.How can i do this ?
Thank you !
|
|
|
|
|
You'd have to write your own method to do this. Although, you would normally call the method something like "GetSomethingBySomeValue", not Fill(value). Make the name of the method meaningful. The concept is called "self documenting code". The name of the method should tell you what it does.
You can use the designer to help you do this by right-clicking the table you want in the dataset designer, and clicking Add Query...
|
|
|
|
|
Hi
I am quite new to this and have made a web project written in vb. Now i want to make a installer for this program and have created a web setup project and a custom action for that project. The thing is that during the install ui i want to run som code when the "next button" is pushed during one of the dialogs. How do i do this?
Confused
|
|
|
|
|
The custom action needs to run an exe with your code in it, you can't inject code into an MSI.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Cant you run for example Orca to customize a button and make it call a external dll or in some other way make it run som code that way? What i need is when a user enters the database name that he wants to use with the web project the program should check if the db already exists before he continues so that he can change the name.
Confused
|
|
|
|
|
Dim DBPath As String
Dim ADOXcat As New ADOX.Catalog
Dim sCreateString As String
DBPath = System.Windows.Forms.Application.StartupPath()
sCreateString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & "\New07ADB.accdb;Jet OLEDB:Database Password=admin;" 'for Access 2007
Try 'Create DB
ADOXcat.Create(sCreateString)
Catch ex As System.Runtime.InteropServices.COMException
'create DB failed
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Failed to create database")
Finally
ADOXcat = Nothing
End Try
Dim ADOXtable As New ADOX.Table(), _
ADOXindex As New ADOX.Index(), _
Con As New ADODB.Connection()
Try 'connect and insert tables
Con.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & "\New07ADB.accdb;Jet OLEDB:Database Password=admin;") 'for 2007
MsgBox(Con.Errors().Count.ToString()) 'Displays 0 Errors
MsgBox(Con.State.ToString()) 'Displays 1 representing an open connection
'Open the Catalog
ADOXcat.ActiveConnection = Con 'Object reference not set to an instance of an object.
I know this error usally gets generated when using a null object but if I receive no errors from opening the connection then 'Con' shouldnt be null right? Any help on this is greatly appreshated.
|
|
|
|
|
Your con is fine, it is the ADOXCat that is not instantiated!
Quote from Great Outdoors:
its a confident traveller who farts in India
|
|
|
|
|
--> which symmetric algorithm is efficient to encrypt video file and why?
--> how can i compress video file in dotNet environment?
J A Nasir K
|
|
|
|
|
1 - they all are, to one degree or another. XVid and DivX are good, but so is MPG.
2 - by using DirectX
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i try to add datepicker to datagrid but i can see it, way?
Private Sub dg2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg2.MouseDown
dtp.Dock = DockStyle.Fill
dtp.Cursor = Cursors.Arrow
dtp.SendToBack()
hitTestGrid = dg2.HitTest(e.X, e.Y)
If hitTestGrid.Column = 5 Then
datagridtextBox.TextBox.Controls.Add(dtp)
dtp.BringToFront()
End If
datagridtextBox.TextBox.BackColor = Color.Black
End Sub
|
|
|
|
|
liat1234 wrote: datagridtextBox.TextBox.Controls.Add(dtp)
You can't add a datetimepicker to a textbox. You can't add any controls to a textbox, unless you are using WPF
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i try to update my data base but i get this error message
"the update command effected 0 of the expected 1 records"
the insertcommand is ok
my code is
Private Sub btnUPDT_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUPDT.Click
'--------------------------------
'INSERT NEW ROWS
'--------------------------------
cmd.InsertCommand = New OleDbCommand()
Dim pCust_name1 As New OleDbParameter("@name1", OleDbType.VarChar)
pCust_name1.SourceColumn = "name"
Dim pCust_pass1 As New OleDbParameter("@pass1", OleDbType.VarChar)
pCust_pass1.SourceColumn = "pass"
Dim pCust_meried1 As New OleDbParameter("@meried1", OleDbType.Boolean)
pCust_meried1.SourceColumn = "meried"
Dim pCust_city1 As New OleDbParameter("@city1", OleDbType.VarChar)
pCust_city1.SourceColumn = "city"
Dim pCust_borndate1 As New OleDbParameter("@borndate1", OleDbType.Date)
pCust_borndate1.SourceColumn = "borndate"
cmd.InsertCommand.Parameters.Add(pCust_name1)
cmd.InsertCommand.Parameters.Add(pCust_pass1)
cmd.InsertCommand.Parameters.Add(pCust_meried1)
cmd.InsertCommand.Parameters.Add(pCust_city1)
cmd.InsertCommand.Parameters.Add(pCust_borndate1)
cmd.InsertCommand.Connection = Conn
cmd.InsertCommand.CommandText = "INSERT INTO users " & _
"(name, pass, meried, city, borndate)" & _
"VALUES (@name1, @pass1, @meried, @city, @borndate)"
'------------------------------------------
'UPDATE ROW
'------------------------------------
cmd.UpdateCommand = New OleDbCommand()
Dim pCust_id As New OleDbParameter("@id", OleDbType.Integer)
pCust_id.SourceColumn = "id"
Dim pCust_name As New OleDbParameter("@name", OleDbType.VarChar)
pCust_name.SourceColumn = "name"
Dim pCust_pass As New OleDbParameter("@pass", OleDbType.VarChar)
pCust_pass.SourceColumn = "pass"
Dim pCust_meried As New OleDbParameter("@meried", OleDbType.Boolean)
pCust_meried.SourceColumn = "meried"
Dim pCust_city As New OleDbParameter("@city", OleDbType.VarChar)
pCust_city.SourceColumn = "city"
Dim pCust_borndate As New OleDbParameter("@borndate", OleDbType.VarChar)
pCust_borndate.SourceColumn = "borndate"
cmd.UpdateCommand.Parameters.Add(pCust_id)
cmd.UpdateCommand.Parameters.Add(pCust_name)
cmd.UpdateCommand.Parameters.Add(pCust_pass)
cmd.UpdateCommand.Parameters.Add(pCust_meried)
cmd.UpdateCommand.Parameters.Add(pCust_city)
cmd.UpdateCommand.Parameters.Add(pCust_borndate)
cmd.UpdateCommand.Connection = Conn
cmd.UpdateCommand.CommandText = " UPDATE users SET [name]= @name, [pass]= @pass, [meried]=@meried WHERE [id] =@id"
cmd.Update(ds1, "users")
MsgBox("update table ended")
End Sub
|
|
|
|