|
Abstract Class in vb.net is a MustInherit Class means which cannot be instantiated you cannot create the object of an Abstract class, you have to inherit it in some other class provided that its not an abstract class also in order to create an object of it. They are basically only used for implementation of base classes.
Hope it helps !
AliAmjad(MCP)
|
|
|
|
|
Thanks for the reply.
What about the Interface. Can you please give one simple example for Abstract ?
Dan
|
|
|
|
|
danasegaranea wrote: What about the Interface.
Interfaces allow us to create definitions for component interaction. They also provide another way of implementing polymorphism.
danasegaranea wrote: simple example for Abstract ?
Public MustInherit Class MIClass
'Overridable Keyword allows you to overide this method and
'Implement your own logic
Overridable Sub mymethod()
'Additonal Code
End Sub
Overridable Function myfunc(ByVal a As String) As String
Return ""
End Function
End Class
Public Class UsingMIClass
Inherits MIClass
Public Overrides Sub mymethod()
MyBase.mymethod()
'Additional code
End Sub
Public Overrides Function myfunc(ByVal a As String) As String
Return MyBase.myfunc(a)
End Function
End Class
Hope it helps !
AliAmjad(MCP)
|
|
|
|
|
Does this code also work with inputobxes
|
|
|
|
|
i am using vb 2005 in a form i have a grid bounding with a bindingsource
now i am writing some search query to search the records, how i can change query string or commandtext of grid control at run time
hope u will understand and reply
faisal iqal ch
|
|
|
|
|
By query strng, do you mean the SQL where the data comes from ? Are you using ASP.NET ? The query strng is how varibles are passed on the URL of a web site.
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 )
|
|
|
|
|
no i am working on windows form
|
|
|
|
|
You can use the DataAdapter to execute a particular query then fill the dataset and use that dataset as a source to fill the DataGridView.
Hope it helps !
AliAmjad(MCP)
|
|
|
|
|
I need to write an application that reads a text file from the mainframe and store the information in a sql table. There's no space, comma or anything that separate the field and content of the field in the text file. I don't even have any idea where to begin. Pls help
|
|
|
|
|
start with being able to get the file off the mainframe. if you can't do that then parsing out the file doesn't come in to play
|
|
|
|
|
So far I have managed to take out the file from the mainframe and stored it as a textfile.
|
|
|
|
|
1) get file off of mainframe - done
2) can you read the file into the program?
|
|
|
|
|
Yes I have written a code to read the file into a program and creates another folder and write the contents of the file
|
|
|
|
|
1) get file off of mainframe - done
2) read the file into the program? - done
3) you say there are no delimiters that you can key off off. that implies these fields are fixed in length. so create your parsing routine for each line read in that breaks it out based on the length of the field.
|
|
|
|
|
Hi all,
I have a C# class with .Cs Extension. Now I want to use these class method in my VB.Net application. How can I do this without creating DLL
Thanks in Advance
Dana
|
|
|
|
|
Translate the code into VB.NET???
|
|
|
|
|
You have two options.
1) Add the C# project to your solution and compile it into a .DLL that your VB.NET project references.
2) Translate the C# code to VB.NET and integrate that code into your VB.NET application.
|
|
|
|
|
You can not mix .NET languages in a single executable (EXE/DLL) file.
Hence, two source languages will result in at least two executable files.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I think there is an obfuscator that also combines assemblies. I'm not sure if it works directly in VS (meaning it produces output from the other projects in the solution).
ROFLOLMFAO
|
|
|
|
|
hi,
my project was developed in vb 6.0 with sql2000 as backend.now i am working in SQL2005 upgration.
when i try to exucte a crystal report(7.0) from a vb component,i get the following error.
Cannot connect SQL server .20599
I doubt that the problem exists with CRPEAUTO.
Or do i need to add any dlls as references..
Plz give ur suggestions to reslove the problem
Thanks in advance
cheers
sangeet
|
|
|
|
|
|
Dear all,
I need to write a sub procedure to show a specified window form, based on the criteria and options choose by user. But it seems the code is so long and also maybe expand later.
Private Sub CallSubForm(ByVal Criteria As String, ByVal UserOption As Integer)
IF Criteria = "A" Then
IF UserOption = 1 Then
FormMainA1.Show()
Elseif UserOption = 2 Then
FormMainA2.Show()
Else
FormMainA3.Show()
End if
Elseif Criteria = "B" Then
IF UserOption = 1 Then
FormMainB1.Show()
Elseif UserOption = 2 Then
FormMainB2.Show()
Else
FormMainB3.Show()
End if
Elseif Criteria = "C" Then
Elseif Criteria = "D" Then
:
:
:
End if
End Sub
Can I pass the name of specified form to a procedure and show it out ?
Like this:
Private Sub CallSubForm(ByVal FormName As String)
:
:
End Sub
Many Thanks !!!
Leo
|
|
|
|
|
Sure you can
Sub SetForSelect()<br />
Dim oFrm As New Form 'declare an empty object<br />
Select Case CriteraOption 'fill the object according to your rules<br />
Case 1<br />
If OtherChoice - 1 Then<br />
oFrm = New frmBaseDlg<br />
Else<br />
oFrm = New frmBaseDlg<br />
End If<br />
Case 2<br />
oFrm = New frmCheckStatus<br />
End Select<br />
<br />
If Not oFrm Is Nothing Then 'Test the object to see if it was filled<br />
oFrm.ShowDialog(Me)<br />
Else<br />
MessageBox.Show("Unsupported criteria")<br />
End If<br />
End Sub
|
|
|
|
|
I have the following code. I am returning a string. If I use return where I have in this way is there a chance I could have left some database connections open still?
Does it skip the connection "Finish with resources" section?
I believe this is the cause to alot of timeout exceptions. Any help much appreciated.
<br />
'Gets any previosuly create about us text <br />
Public Function GetAboutUs(ByVal ProductID As Int32) As String<br />
' Create Connection<br />
Dim HSConn As New SqlConnection(ConfigurationManager.ConnectionStrings("RemoteSqlServer").ConnectionString)<br />
' Create data reader<br />
Dim dr As SqlDataReader<br />
'Declare Command<br />
Dim HSComm As New SqlCommand()<br />
<br />
Try<br />
HSConn.Open()<br />
' Provide connection<br />
HSComm.Connection = HSConn<br />
' Provide command type and command<br />
HSComm.CommandType = CommandType.StoredProcedure<br />
HSComm.Parameters.AddWithValue("ProductID", ProductID)<br />
HSComm.CommandText = "SP_ProductAboutUsSelect"<br />
<br />
'Execute the command<br />
dr = HSComm.ExecuteReader<br />
<br />
While dr.Read()<br />
'If there is a Tagline return it. Otherwise return nothing<br />
If dr.IsDBNull(0) Then<br />
Return Nothing<br />
Else<br />
Return dr.GetString(0)<br />
End If<br />
End While<br />
<br />
'Return in case value is not found<br />
Return Nothing<br />
<br />
Catch ex As Exception<br />
' Failed to retrieve tagline so return false<br />
Emailer.ErrorEmail(ex, Page)<br />
Return Nothing<br />
End Try<br />
<br />
' Finish up with resources<br />
dr.Close()<br />
HSConn.Close()<br />
<br />
End Function
|
|
|
|
|
Hi,
this does not look OK; everytime you return, the remainder of the function is not executed,
in particular the Close statements at the end.
There are two solutions to this:
1. don't use return except as the last statement; instead store the result value in some
variable (say result), and proceed throughout the function, that ends on return result
2. use a try/catch/finally construct with the Close lines in the finally block; they will
get executed even when you exit the try or catch parts in whatever way (even with return).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|