|
Dim listItem As ListViewItem
Dim subItem As ListViewItem.ListViewSubItem
For Each listItem In ListView.Items
For Each subItem In listItem.SubItems
...
Your code here
...
Next
Next
|
|
|
|
|
Is there any particular reason why you are using an ODBC provider and not the SQL Server provider in ADO.NET?
Anyway, this code:
OdbcCmd.CommandText = "Call AddMember(?, ?, ?, ?)"
OdbcCmd.CommandType = CommandType.StoredProcedure Appears to be causing the problem. If you use the CommandType.StoredProcedure then the CommandText should contain the name of the stored procedure and nothing more.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Thanks for the reply. I'm new to VB so I haven't seen anything that says to use one or the other and why. I tried your suggestion and I'm still getting an error. Here are the results when I just provice the procedure name:
MSSQLJOB 964-9a4 EXIT SQLExecDirectW with return code -1 (SQL_ERROR)
HSTMT 03A31BC0
WCHAR * 0x010C08E8 [ -3] "AddMember\ 0"
SDWORD -3
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_acctnum, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_name, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_ssn, which was not supplied. (201)
DIAG [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure AddMember expects parameter @mbr_employee, which was not supplied. (201)
|
|
|
|
|
You didn't answer my previous question: Is there any particular reason why you are using an ODBC provider and not the SQL Server provider in ADO.NET?
If there is a specific provider for your database in .NET (and for SQL Server there is) then use the classes of that provider rather than use ODBC. Use SqlCommand, SqlConnection and so on rather than OdbcCommand, OdbcConnection and so on unless you have a very compelling reason to use the ODBC provider.
Scottish Developers upcoming sessions include:
.NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
My: Website | Blog
|
|
|
|
|
I have my base form which has background image , tool bar etc,All other
forms inherit it. The background image size is 34kb and it is in Jpeg
format.All the other forms also has many images since we have unique look and
feel. The issue I am facing is performance .
Application works fast when I don't have background image on my base form (
in turn we don't have any background image for any of the form), But when I
apply background image for the base form or individual form , screen loads
slowly ie.. the controls on the screen loads slowly .
is there any way to overcome this problem
Technology - Windows form in VB.Net
Sudheendra
|
|
|
|
|
Hello. I am making a wave player with a playlist, and I'm using the My.Computer.Audio object to play wavs. So I was wondering if there's any method or something that can tell me when a sound is not playing? So I can write code for making it play the next wave in the playlist when the preciding is finished playing. Thanks in advance
----
Dim Sleepy as Boolean = True
If Me.Sleepy = True Then
Goto Sleep
End If
----
|
|
|
|
|
Is there a way of getting the length of a string in pixels based on the current font so you can change the size of a label to fit the text in exactly like the MessageBox.
I'm trying to create my own dialog box that pops up with a user entered message at a specific time. I dont want to limit the user to a certain character length.
Many thanks
The FOZ
|
|
|
|
|
I use this method to adjust the font size so my strings fit in the available width.
Dim ThisFont As Font = AdjustFontSize("Steve", 40, New Font(Me.Font.Name, Me.Font.SizeInPoints, Me.Font.Style))<br />
<br />
<br />
Public Function AdjustFontSize(ByVal s As String, ByVal w As Integer, ByVal LocalFont As Font) As Font<br />
Dim Gr As Graphics = Me.CreateGraphics<br />
Dim ThisFontSize As Single = 15.0!<br />
<br />
Do<br />
ThisFontSize -= 0.5!<br />
LocalFont = New System.Drawing.Font(LocalFont.Name, ThisFontSize, LocalFont.Style)<br />
Loop While (Gr.MeasureString(s, LocalFont).ToSize.Width > w) AndAlso (ThisFontSize > 7.5!)<br />
<br />
Gr.Dispose()<br />
Return LocalFont<br />
<br />
End Function<br />
|
|
|
|
|
Thanks for that. Looks like I can use the MeasureString method to get the results I want.
Ta
The FOZ
|
|
|
|
|
i am devloping s/w in vb.net 2005 and oracle.
on my pc. its running fine..but when i try to copy on the other machine c drive or network drive ..it gives me error that TNS coulnot resolve the service name. actually i am using oracle provider for oracle in microsoft. and importning system.data.oracleclient.dll which is resides in microsoft.framework 2.0 directory. on the other machine they have installed .net framework 2.0. i dont know the problem..why its giving me the problem.
and ofcourse it runs on network drive on my computer. i dont understand that if it is running on network drive on my pc then why not on the other?
if anybody knows the solution , let me know asap.
i've triend tnsnames.ora and all..
but couldnot able to solve this problem//
hemaxi
|
|
|
|
|
Does this other machine have the actual Oracle Client software installed on it?? Without it, the OracleClient namespace won't work. I think the machine has to have MDAC 2.8 SP1 or better installed, then at least Oracle Client 8i Release 3.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Try connecting to the Oracle Database using Sqlplus on the machine you are having problems with. If you can connect, then look for multiple tnsnames.ora file on the machine. Also make sure your Oracle Home points to the right directory in your Environment variables.
Mike Lasseter
|
|
|
|
|
You might want to reply to the OP so he gets a message that you posted a reply.
I'm not having the problem with (gag, puke) Oracle.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Try connecting to the Oracle Database using Sqlplus on the machine you are having problems with. If you can connect, then look for multiple tnsnames.ora file on the machine. Also make sure your Oracle Home points to the right directory in your Environment variables.
Mike Lasseter
|
|
|
|
|
Hi All,
I'm new to mulththreading concepts in VB.NET (I'm using V1.1).
I understood that calling Th.Join , where th is a Thread object, the calling thread should wait for th finishing his job before continue executing.
Maybe I'm wrong, but when I scheduled in a ThreadPool some writing to console, after a Join in the main thread, nothing is displayed.
In the code below I expected to see "End of TA" followed by "Urka" written to console. But it isn't so. The code exit with "End of TA" only.
I locked everything and Console is thread safe so why "urka" is not displayed?
Many Thanks
Manu
<br />
Imports Microsoft.VisualBasic<br />
Imports System<br />
Imports System.Threading<br />
<br />
Module bub <br />
dim c as Contatore<br />
dim d as Contatore<br />
<br />
<br />
Sub ThreadFuncC(stateInfo as Object) <br />
Dim d as String<br />
d = CType(stateInfo, String )<br />
Console.WriteLine( d )<br />
End SUb<br />
<br />
Sub ThreadFuncA( )<br />
dim s as integer<br />
For s=0 to 20<br />
c.IncrementCounter()<br />
Console.WriteLine("by Thread A {0}", c.GetI())<br />
Thread.Sleep(100)<br />
Next<br />
End Sub<br />
<br />
Sub ThreadFuncB( )<br />
Dim s as integer<br />
For s=0 to 10<br />
d.IncrementCounter()<br />
Console.WriteLine("by Thread B {0}", d.GetI())<br />
Thread.Sleep(200) <br />
Next<br />
End Sub<br />
<br />
class Contatore<br />
Shared Sub IncrementCounter()<br />
SyncLock sync_i<br />
i = i +1<br />
End SyncLock<br />
End Sub<br />
<br />
Function GetI() As integer<br />
SyncLock sync_i<br />
Return i<br />
End SyncLock<br />
End Function<br />
<br />
Shared i as integer = 0<br />
Shared sync_i as object = new object<br />
<br />
end class<br />
<br />
Sub Main() <br />
<br />
c = new Contatore<br />
d = new Contatore<br />
<br />
dim ta As Thread<br />
dim tb as Thread<br />
dim tc as Thread<br />
ta = new Thread(AddressOf ThreadFuncA)<br />
tb = new Thread(AddressOf ThreadFuncB)<br />
tc = new Thread(AddressOf ThreadFuncB)<br />
ta.Start() <br />
tc.Start()<br />
tb.Start()<br />
ta.Join() <br />
Console.WriteLIne("End TA")<br />
Dim f as String = "Urka!!"<br />
ThreadPool.QueueUserWorkItem( AddressOf ThreadFuncC,f ) <br />
End Sub<br />
End Module<br />
ManuStone
|
|
|
|
|
It looks like you call the threadpool right before your program exits. Thread pool threads are background threads and they most likely will not run by the time your program finishes. Put a ReadLine() at the end of your Main and see if that works.
|
|
|
|
|
Hi Dustin,
many thanks for your response!
It works!
The strange is that now I'm testing my code in a different PC and he works too. I think that you are right! If I understood well, there is the risk that the ThreadPool cannot execute just before the exit, so better to introduce some pause.
Thanks again for you help
Manu
ManuStone
|
|
|
|
|
Hi
I'm using SQL Server 2000 and it is working properly.
But when I use sqldataadapter in VS.NET 2003 and make a connection to database through Data Adapter Configuration Wizard it works fine till making connection,when i generate sql statement through Query Builder in DataAdapter Configuration Wizard and add fields to it and Click Next to see results of SQL Query then it gives this error:
"Generated SELECT Statement"
"cannot generate SSPI context"
I have reinstalled SQL SERVER BUT suggest me should I reinstall VS.NET 2003 Again or is there any solution?
Regards
|
|
|
|
|
i'm sure the last suggestion you said won't paint a smile in your lips
so what is better to do is trying to write the data adapter & configurate it with code
imports system.sqlclient.data
here open your connection & declare your adapter & affect the query to it
if you know how it iks better to work like that i even don't prefer working with the wizar with code you understand better
i hope it wil works
try to be good if you can't be the best
|
|
|
|
|
Sir,
There is a string like "this is a string"
I want to select substring "string" programically.I mean at run time it comes in the label control in the selected format and the remaining substring will be unselected.
Like in msdn library a search keyword is entered .now the result description comes with the search keyword selected i.e having blue background of the search keyword.
Please help me.
Thanks and Regards
amaneet Brar
|
|
|
|
|
Use the "Select" method of the textbox control
i.e.
to select "World" in the string "Hello World" use
TextBox.Select(6, 5)
The FoZ
|
|
|
|
|
Sir,
I have a program containing more then 35 textboxes and have 2 pages .Can you please send me code for checking the preview of the page and finally printing the page.
Thanks and regards
Amaneet Brar
|
|
|
|
|
how to read data from excel file and to push data to sql server
|
|
|
|
|