|
We would refer Type library and Dll files in some different ways in .net.
I like to know what happens in compilation and execution time of the different ways of declaration.
1. imports System.IO
2.Dim lobjConfig As New PrjConfigInfo.ClsConfigInfo()
3.Private Declare Function Trans_Ticket Lib "InlottPrint.dll" (ByVal lStrPrintStr As String) As Integer
4.Add by Reference in solution explorer in .net IDE.
I am totally confused with this.
Plz Expain Anybody.
Thanx in advance
Satish Chandra Kumar
satish_softin@rediffmail.com
InLott Technologies Pvt Ltd
Chennai
|
|
|
|
|
not sure i understand well, but here is what happens.
first, i don't proceed in the same order as you. here is mine :
1. Adding a reference to a project of the solution.
As it says, you create a link to the functions and classes within the dll you reference.
this way, you will be able to use and call them.
2. Importing a namespace.
that command allow you not to use the entiere namespace instead of retype it each time you call a member of that namespace (Console.WriteLine() instead of System.Console.WriteLine() for example)
3. Dim lobjConfig As New PrjConfigInfo.ClsConfigInfo()
Declares a variable lobjConfig of type PrjConfigInfo.ClsConfigInfo and initializes it with a reference of a new object of this type (with Default constructor New() ).
4. Private Declare Function Trans_Ticket Lib "InlottPrint.dll" (ByVal lStrPrintStr As String) As Integer
Hem, personnaly, i never use this... so, i cannot help you well on this
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
hi
as you know,there are *.gif files and
these pictures contain some move.
and the query.. how can i use this picture files
in vb6
thanks for all
|
|
|
|
|
Hi all,
Any one have sample code or any link of CRUD application.... using Data Grid.
plz share it...
thanx
Sajjad
|
|
|
|
|
Hi,
The following ling link have something related to ur thread
Just try.....
http://www.novicksoftware.com/Articles/crud-operations-using-sql-server-stored-procedures-part-1.htm
all the best
Satish Chandra Kumar
satish_softin@rediffmail.com
InLott Technologies Pvt Ltd
Chennai
|
|
|
|
|
Hi all,
I m develop a application with Asp.net(vb.net) and it uses SQL Server 2000 database.
In my application user add or update some Record in database.
I wanna , whenever user add the record,Time and date is captured....
or whenever user Update the record,Time and date is captured....
plz discuss in detail...
NOTE : I m not using Store Procdure
thanx in advance
Sajjad
|
|
|
|
|
well you have to put this question in SQL Forum. But Since you are here So the solution is you have put the date and time in table either same or different.
add two fields in your same table..
InsertedOn and ModifiedOn.
Now in InsertedOn put default value GetDate() (* SQL function). and do not insert this through your code. it will automatically populate when record will be inserted.
when user will modify any record from ASP then in update query put the new date in ModifiedOn to keep the record of last updated record. For Modification you can also write the trigger. On after insert and there you can use the getdate function to update the modified date.
Option 2.
Create a new table and put these values inserted on and modifiedON in this table when any event occur on ASP page. like adding or modifying the record.
|
|
|
|
|
|
hi
i want to know how i can access the mapped network drive. what thing i should know of the computer to which drive i want to access. if anybody can answer i shall be thankful.
ddd
|
|
|
|
|
|
The selectvalue of combobox is the bug.
For example,
Public Class DataModal
Dim m_ID As Long
Dim m_Name As String
Sub New(ByVal nID As Long, ByVal sName As String)
m_ID = nID
m_Name = sName
End Sub
Property ID() As Long
Get
Return m_ID
End Get
Set(ByVal value As Long)
m_ID = value
End Set
End Property
Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
End Class
IN a WinForm,
Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles comboCustomer.SelectedValueChanged
Dim obj As New DataModal(0, "")
obj = comboBox1.SelectedValue 'Show Error here
obj.ID=combobox1.SelectedValue 'Show Error , too
SelectedCustomerID = obj.ID
obj = Nothing
End Sub
Now , there is no method to get the ID of selectvalue.
|
|
|
|
|
This is plainly a bug that cannot exist in the .NET framework. No-one at microsoft noticed that comboboxes were totally broken ?
What's the error, is it a null reference ? The only error I can see happening in both lines of code is if comboBox1 has become null for some reason, you'll get a null reference exception.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In Step-by-step process, I found the combobox1.selectvalue has value.
When you use long type ,such as
Dim ID as long
ID=combobox1.selectvalue
The vs.net tell that selectvalue is a object which has a member ID 1 and name value "".
When you use obj type , such as
dim obj as new datamodal(0,"")
obj=combobox1.selectvalue
The vs.net tell that selectvalue is a long which value is 1.
I am sure of that.
(VS.net 2005 beta 1)
|
|
|
|
|
rushing wrote:
(VS.net 2005 beta 1)
Your beta is out of date, and seeing as you're using a beta, you should be reporting these sort of problems to Microsoft ( that's the reason they give out a beta ) AND you should have the sense to say what platform you're using when you make claims out bugs. In beta 1, combo boxes may well have bugs - it's a beta, for goodness sakes.
It sounds like you're getting very confused. You're saying there's no error now, it's finding the values OK ? The object you're finding could well be a nullable int ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
They are having error now.
The value could be get from vs.net platform , but could not be get from code or application.
My system is windows 2000 server.
|
|
|
|
|
rushing wrote:
The value could be get from vs.net platform , but could not be get from code or application.
OK, so intellisense can see it, but not your code. You've still not told me what the error you're getting is. Have you tried the 'object obj = ' line in your code and then checking the value/type of obj in the debugger ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The error is :
a long type value could not be convert to an object
or
a object could not be convert to a long
|
|
|
|
|
There is no implicit cast between object and long - have you even tried explicitly casting it if it is in fact the "correct" value?
|
|
|
|
|
|
Private Sub LoadCustomer()
Dim m_c As New ClassCustomer
Dim arr As New ArrayList
arr = m_c.LoadCustomer()
With comboCustomer
.DataSource = arr
.DisplayMember = "Name"
.ValueMember = "ID"
End With
arr = Nothing
m_c.Close()
m_c = Nothing
End Sub
|
|
|
|
|
Well there you go. Try Convert.ToInt64(whatever) - it won't do that for you by itself.
However, a long should convert to an object, it should just box it for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hey, I'm trying to display the contents of a text file that I've selected from a ListView in a RichTextBox. So far I've found that I can't get the file name from the ListView, and I'm having extreme difficulty in finding a way to pull the PIDL instead.
My current code doesn't show that I'm trying to read the file inside the RichTextBox yet, as I work in steps confirming everything individually, and currently I can't validate the file name requested. So my MAIN concern is getting the file to open based on the selected item from the ListView. (anybody willing to help with the stream reader or other means to read in the text box will be happily accepted.)
When I select an Item from the ListView I get an exception / error stating : "The system can't find the file specified "........ any ideas?
current code is as follows:
p.s. if i change to the "'("c:\test.txt")" the code works as requested and opens the specific file (note, this is not a file listed in the ListView, only a test subject file)
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Dim ListViewItem As New ListViewItem
Try
System.Diagnostics.Process.Start(ListViewItem.Selected) '("c:\test.txt")
MsgBox("help me", , MessageBoxButtons.OK)
Catch ex As Exception
MsgBox(Err.Description, vbCritical, "Error " & CStr(Err.Number))
End Try
End Sub
Why is common sense such an un-common comodity?
|
|
|
|
|
wetrivrrat wrote:
p.s. if i change to the "'("c:\test.txt")" the code works as requested and opens the specific file (note, this is not a file listed in the ListView, only a test subject file)
What is the value you're getting back from the list view ? Is it the name of a file, and you need to qualify it with a path name ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm using "For Each drive In Environment.GetLogicalDrives()" to load a TreeView, then showing the folder contents in the ListView, so the value of the ListView Item would be shown onscreen as "sites.txt", "testdoc.txt", etc....
and then loading the ListView like this:
Dim dirInfo As DirectoryInfo = New DirectoryInfo(e.Node.FullPath)
ListView1.Items.Clear()
If (dirInfo.Exists) Then
Dim fileInfos As FileInfo() = dirInfo.GetFiles()
Dim info As FileInfo
For Each info In fileInfos
Dim item As ListViewItem = New ListViewItem
item = ListView1.Items.Add(info.Name)
item.SubItems.Add(info.LastAccessTime.ToString())
Next
End If
just for laughs I cut the system.diagnostics line out and put this inplace-----
RichTextBox3.LoadFile(openfile1.FileName, RichTextBoxStreamType.PlainText)
When I did this I get a new error which states :"Empty path name is not legal"
which seems self-evident that the problem is clearly the ListView is not keeping the path name its only displaying the text 'returns' from the TreeView. I also changed the line "item = ListView1.Items.Add(info.Name)" to show (info.fullName) and I still get the "Empty path name is not legal" error.
Also, I removed the "openfile1.FileName," from the LoadFile statement and I get the following error: "Could not find file "G:\VB.net\Slider tests\bin\1" " so it looks like its not even seeing the true pathname....
thanks
Why is common sense such an un-common comodity?
|
|
|
|
|
You've got a couple of problems. The ListViewItems don't have the full path to the files because you never saved the full path in them. You need both the filename so you can show the user just that, the short filename, and you need the full path to the file so your code can get it easily. You're only doing one of those things.
The ListViewItem class has a Tag property that can store just about any type of object. In your code, it's probably a good idea to store the full path to the file in there so you can retrieve it later when you go to open the file.
Dim dirInfo As New DirectoryInfo(e.Node.FullPath)
If (dirInfo.Exists) Then
ListView1.Items.Clear()
Dim fileInfos As FileInfo() = dirInfo.GetFiles()
Dim info As FileInfo
For Each info In fileInfos
Dim item As New ListViewItem(info.Name)
item.SubItems.Add(info.LastAccessTime.ToString())
item.Tag = info.FullName
ListView1.Items.Add(item)
Next
End If
Now, your second problem. When you go and open the file in your doubleclick handler, you're actually creating a new instance of a ListViewItem, a blank one!, and using that to supply the filename your trying to launch. Obviously, you can't do that. You have to use the selected item in the ListView.
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Try
System.Diagnostics.Process.Start(ListView1.SelectedItem.Tag)
Catch ex As Exception
MsgBox(Err.Description, vbCritical, "Error " & CStr(Err.Number))
End Try
End Sub
* Note: The code in this post has NOT been tested.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|