|
Hi,
I'm trying to query some data into a listview.
When there is more than one row of data on the listview, how can I choose a specific row to be displayed into a new form?
-----------------------------------------
MyQuery1 = "SELECT Date, Author, Comments, Ratings FROM [books] WHERE [name] = '" & txtbooksname.Text & "' "
Do While Not rs1.EOF
Set anItem1 = lvwRvw.ListItems.Add(, , rs1(0) & vbNullString)
For m = 1 To rs1.Fields.Count - 1
anItem1.SubItems(m) = rs1(m) & vbNullString
Next m
rs1.MoveNext
Loop
------------------------------------------
example:
Row Date Author Comments Ratings
1 01/01/2005 aaa romance B-
2 01/02/2004 bbb advanture B+
3 01/02/2005 bbb advanture B
How can I get the details of row 2 to be displayed on a new form?
Thank you very much.
|
|
|
|
|
Take a look at the ListViews Items collection. Each listitem has a collection of subitems.
My Blog[^] FFRF[^]
|
|
|
|
|
|
Hi all,
Until now we used to send stored procedure and ask the client to execute it using SQL Query Analyzer. Now we are supposed to do that through vb.net. I have a vb.net form with a multiline text box. User selects the stored procedure that gets displayed in text box. Now how do I execute this stored procedure? I tried using command object but it does not work. Below is sample stored procedure:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_InsertInCharges]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_InsertInCharges]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE sp_InsertInCharges(@strRemarks As Varchar(100), @intTrnNr As Integer)
AS
declare @AccNr as int
declare @RoutingAccNr as int
declare @AmountDue as float
declare @strSQL as varchar(4000)
INSERT INTO Charges(ShipNr, ChargeID, Transaction_Nr, Sales_TrnNr, Partial_Sales_Nr, Charge_Date, Account_Nr,
Routing_Account_Nr, Cruise_Nr, Department_Code, Amount, IsTaxApplicable,
TaxType, TaxAmount, TaxPercent, Gratuity, Discount, Amount_Due, Charge_Type,
Payment_Type, Remarks, Bill_Number, User_Nr, Bill_Settled, Ex_Transaction_Nr,
ExcursionID, Event_Source,SettlementStatus)
SELECT ShipNr, ChargeID, Transaction_Nr, Sales_TrnNr, Partial_Sales_Nr, Charge_Date, Account_Nr,
Routing_Account_Nr, Cruise_Nr, Department_Code, Amount, IsTaxApplicable,
TaxType, TaxAmount, TaxPercent, Gratuity, Discount, Amount_Due, Charge_Type,
Payment_Type, @strRemarks As remark, Bill_Number, User_Nr, Bill_Settled, Ex_Transaction_Nr,
ExcursionID, Event_Source,SettlementStatus FROM Charges
WHERE Transaction_Nr = @intTrnNr
Set @strSQL = 'Select Account_Nr, Routing_Account_Nr, Amount_Due into Chargestemp from Charges WHERE Transaction_Nr = ' + Cast(@intTrnNr as varchar)
Exec @strSQL
set @strSQL = '
Select Account_Nr, Routing_Account_Nr, Amount_Due into Chargestemp from Charges WHERE Transaction_Nr = ' + Cast(@intTrnNr as varchar)
Exec (@strSQL)
declare Charges cursor for
Select Account_Nr, Routing_Account_Nr, Amount_Due * -1 from Chargestemp
open Charges
fetch next from Charges into @AccNr, @RoutingAccNr, @AmountDue
while @@fetch_status=0
begin
IF @RoutingAccNr <> Null or @RoutingAccNr <> ''
EXEC sp_UpdateDepositLimit @AmountDue, @RoutingAccNr
ELSE
EXEC sp_UpdateDepositLimit @AmountDue, @AccNr
fetch next from Charges into @AccNr, @RoutingAccNr, @AmountDue
end
close Charges
DEALLOCATE Charges
drop table Chargestemp
DELETE FROM Charges WHERE Transaction_Nr = @intTrnNr
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
|
|
|
|
|
Dim conn As New SqlConnection
conn.ConnectionString = Session("ConnectionString").ToString
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo.yourProc"
Dim Prm1 As New SqlParameter("yourParam", SqlDbType.Int)
Prm1.Direction = ParameterDirection.InputOutput
cmd.Parameters.Add(Prm1)
Prm1.Value = Your Value
conn.Open()
cmd.ExecuteNonQuery()
conn.Dispose()
cmd.Dispose()
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
Hi there,
Sorry .... I did not explain it properly. Now me try to explain. The above sample I posted is my stored procedure. Now this SP is on my machine. I send this to my client. My client will use SQL Query Analyzer to first run this script that will create this stored procedure in SQL Server. Now what I need is that my client should not use SQL Query Analyzer to "create" this SP. We want to load this script in text file and then create this SP through .NET. Is there any way to create SQL Query Analyzer object in .NET and run this?
Regards,
Vilas
|
|
|
|
|
|
I am trying to populate a combobox from a dataset/tableadapter. Is this possible?
Thanks
Brad
|
|
|
|
|
|
Hi All,
I have an interesting problem. I have a form with a DriveListBox control on it. I have a subroutine that is suppose to list the folders on the selected drive. The subroutine is from the Visual Basic help.
Subroutine:
Sub ShowFolderList(strPath As String)
Dim fs As Object
Dim f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(strPath)
Set fc = f.SubFolders
For Each f1 In fc
s = s & f1.Name
s = s & vbCrLf
Next
MsgBox s, , "ShowFolderList"
End Sub
The purpose of this subroutine is to list the folders for the designated path. So if I enter “C:” I should get a list of the folders listed in the C: drive. But when I input C: for the drive I get these values coming into the ShowFolderList subroutine.
Drive = C:
? strPath
c:
? f
C:\Program Files\Microsoft Visual Studio\VB
Why is it showing the above path when I selected only C:?
But when I select a different drive I get this:
Drive = F:
? strPath
f:
? f
F:\
This one will list all the folders in the F: drive, because the F: has a backslash on it. While the C: didn’t. But when I select the C: drive again I get the same thing with the C drive as I have previously shown, but if I concatenate a “\” onto the Drive1.Drive call it will work like it should.
All this brings up the question why do I need to concatenate a backslash onto a C drive call to return the folders, but I don’t have to concatenate one on any other drive?
Thank you,
Quecumber256
|
|
|
|
|
Quecumber256 wrote: But when I select the C: drive again I get the same thing with the C drive as I have previously shown, but if I concatenate a “\” onto the Drive1.Drive call it will work like it should.
Because you're not specifying a complete path when you enter "C:". Since you didn't specify the root directory, "C:\", the rest of the path will be built using the current directory, in your case, C:\Program Files\Microsoft...
It works for the other drives because the current directory on those drives is the root, "F:\".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave,
Its strange because all the DriveListBox does is show the drive letter. By default it should start at the root directory and work it way down.
Thank you,
Quecumber256
|
|
|
|
|
Yes, it returns a drive letter, but it returns a string representing ONLY the drive letter, not a complete path. It's your responsbility to do any fixup of this string so there is no ambiguity when you pass it to whatever function your calling.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i want to create a onscreen keyboard that will depict all the functionalites ofthe actual working keyboard.I tried to perform the task by creating the control array of buttons.but however the keys are notworking for caps lock,shift,etc.I have to also change the language to some other instead of english if the related button is clicked.I want the entire source code for the on screen key board operation.Please help me its urgent for me as I have to return the project within five days.
rajan manoj
maxim software solutions
Kerala
|
|
|
|
|
You would be reinventing the wheel - there is an on-screen keyboard utility that comes with windows .. look in Accessories -> Accessibility.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Hi,
I recently started using winsock in VB6 and found it to be a nifty 'little' control.
Now I'm trying to do the same in VB .Net and found it to be a problem.
I'm not very experienced in .Net.
I'm trying to read the state of my winsock control.
In VB 6 I simply used:
if myWinsock.state <> sckConnected then
myWinsock.connect
end if
This same code in .Net tells me I cant use .state in an expression because it's a TYPE.
So I had a look in the library and found that there are two winsock classes:
AxMSWinsockLib
and
MSWinsockLib
With the bottom one I can read the state of my socket but everytime I add a socket to the form, VB adds a AxMSWinsock instead of a normal winsock, how can I tell VB that I don't want an AxMSWinsock?
|
|
|
|
|
|
Thanx, thats EXACTLY what i wanted!
|
|
|
|
|
VB.Net/MS Access. I have made an application in vb.net, access. I need to provide this application to different users. I have installed the application on a different machine on the network. Can I deploy the MS Access database one machine and use the application on different machines. What is the path that needs to be set if such a case has to be implemented.
With Best Regards,
Mayur
|
|
|
|
|
Sounds to me that you want the database to reside in one location as it should.
Your application needs to point to that database. Meaning that the connection string
needs to point to that location. Use your app config/reg entry/xml doc what ever to specify where the database is located.
|
|
|
|
|
Hi all ..
I'm printing some images through PrintDocument.
I need to get the height in millimeters or centimeters before I send it to document. Is there any way of doing this? I have searched through graphics namesspace and only found ways om doing string measurements.
Pleae help
Regards // H
|
|
|
|
|
|
Hello Friends,
I'm working in VB.Net and want to develop a like media player can anyone suggest me how i can do it in Vb.Net.plz
Reagards
Raj Sharma
|
|
|
|
|
|
Hi, I am working on a web parts custom control which consists of a label,a list box and a context menu. I bounded the context menu to the list box such that when the user rightclicks on the list, the menu will appear. However, when the menu appears, it is blocked by the listbox. Hence only part of the menu is visible. How do I make the menu to be totally visible and to appear 'on top of' the listbox?
A code snippet is below:
list1.ID = "List1" 'List's ID
listitem1.Text = "Testing" 'List's items
listitem2.Text = "Event"
list1.Items.Add(listitem1)
list1.Items.Add(listitem2)
Me.Controls.Add(label1) 'Add the list as part of the custom ctrl
menu1.ID = "ContextMenu1"
menuitem1.Text = "Acknowledge" 'Menu Items
menuitem2.Text = "Testing"
menu1.ContextMenuItems.Add(menuitem1)
menu1.ContextMenuItems.Add(menuitem2)
menu1.BoundControls.Add(list1) 'Attatch menu to the list
Me.Controls.Add(menu1) 'Add the menu to the custom control
The code is in Visual Basic 05. Advice will be appreciated!
|
|
|
|
|