|
How do I get the row value when the user selects the row from the list view?
|
|
|
|
|
Does each subitem have an index or id?
If so, how do I get the index of each subitem?
|
|
|
|
|
Hello
I would like to be able abort a function or sub when i push a button (Stop). Assume for example that
I have made an app that searches for files, and by "mistake" I enter a search argument like *.*
on a very large disc that has a very large number of files. Or maybe I just want to quit searching....
I was thinking about something like this (pardon my outrageous pseudo pseudo code)
Function SearchForfiles (some params) as SomeType<br />
<br />
here is lot of code (recursive stuff, loops and what have you)<br />
<br />
'here comes the thing I'm looking for:<br />
<br />
If (user presses the button Stop) Then<br />
Exit Function or Sub<br />
End If<br />
<br />
End Function (End Sub)
And after the user has pressed the stop button everything is normal again and he can do a wiser
search this time. So the main question is how to stop the execution of a sub routine without ending the app,
and the second question is how the function/sub is supposed to know that the user pressed a button
I hope you understand what I'm Looking for
Bye for now
Tim
|
|
|
|
|
You need to research multi-threading. You could start by researching the background worker control.
Hope this helps.
|
|
|
|
|
I found a solution myself. It's so ridiculously simple that discarded it first as TOO ridiculous. anyway here it is.
Inside the the recursive function that searches for files i have this statement:
<br />
'txtStop is an invisible textbox<br />
If txtStop.Text = "0" then<br />
Exit Function<br />
End If <br />
<br />
On the form I have a button with the caption "Stop search" and the button code is:
<br />
Private Sub btnStopSearch_Click()<br />
Me.txtStop.Text = "0"<br />
End Sub<br />
Ain't it ridiculous! Thanks for the tip though about the multi threading
|
|
|
|
|
What you're doing now is pretty obvious, the trouble is, if the processor is really busy, the UI is not going to be responsive, and so the button press won't always register.
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 )
|
|
|
|
|
|
It does in your limited tests. Get a folder with a large number of files in it and your code will fall on its face. The button will not respond until the code returns control back to the UI to process events. This can take a while. For example, I've got 3 machines right now with over 13.5 MILLION files each in a small directory tree off the root of C:. It takes 45 minutes just to get properties on the root folder to see who much space is available.
Your use of a hidden TextBox is also very dependant on the UI being able to process and is very unnecessary. A simple Boolean variable would do the exact same thing without all the overhead of a control.
Moving the search to its own thread is a FAR better method leaving your UI responsive to every click of that button, no matter how many files there are in a folder.
On local hard drives, searches go pretty quick. When you doing the search on a remote volume over a network, these kind of searches take FAR longer, mostly hanging on remote I/O. The time your UI thread (in your implementation) is blocked (unresponsive to user actions) is FAR greater than for a search on a local drive.
|
|
|
|
|
Some poeple just don't get it
|
|
|
|
|
recurring customers?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
How would I make a timer click for me? EX. If i clicked a button that would start the timer then the curser would start clicking at the intervel on the timer/
|
|
|
|
|
click on what? your button? if so: in timer_tick-event: button1.performclick
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
In your button's click event handler, you should use YourTimer.Start , where YourTimer is the timer you created...
"That's the problem with a spell checker. It only helps with bad spelling, not stupidity." - Rob Graham
|
|
|
|
|
Hey,
I'd like to know how I can drag and drop controls during runtime.
I am using Visual Studio 2005 --> Visual Basic.
Thanks,
--Zaegra--
|
|
|
|
|
What do you have difficulty with? Be more specific.
You need Mousedown-Event for the control you want to drag to start Drag&Drop, and DragOver- and DragDrop-Event for your control you want to drop that first control in. But I am sure you figured that out yourself.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Hi All
I have created a DAL using datasource and added few function and it accept from and to Date. Then added a Report Viewer control to my Windows application. After that I added new item Report1.rdlc. Then I dragged field from Dataset on to Report1 and organized and set the Datasource .rdlc to the Report Viewer control after that I executed my application working fine. Now I decided to added two datetime parameter to my Report1 and added. When I try to run the .SetParameters it thrown error as 'An error occured during local report processing'
Could you please help me how to solve.
<code> Dim rsDataSource As New ReportDataSource("OT Applied Info", OverTimeEntryTable)
Me.Reports.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Me.Reports.LocalReport.EnableExternalImages = True
Me.Reports.LocalReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence)
Me.Reports.LocalReport.DataSources.Clear()
Me.Reports.LocalReport.ReportEmbeddedResource = "OTApplied.rdlc"
Me.Reports.LocalReport.DataSources.Add(rsDataSource)
Dim params(0) As Microsoft.Reporting.WinForms.ReportParameter
params(0) = New Microsoft.Reporting.WinForms.ReportParameter("SDate", Format(CDate(dtpSDate.Text), "MM-dd-yy"), True)
params(1) = New Microsoft.Reporting.WinForms.ReportParameter("EDate", Format(CDate(dtpEDate.Text), "MM-dd-yy"), True)
Me.Reports.LocalReport.SetParameters(params)
Reports.LocalReport.DataSources.Add(rsDataSource)
Reports.Visible = True
Reports.LocalReport.Refresh()</code>
Thanks
Sonj<big></big><big></big>
|
|
|
|
|
Hi All,
No help from any one of them however I found that ReportEmbeddedResource is follows application name for example Me.Reports.LocalReport.ReportEmbeddedResource = "ReportProject.OTApplied.rdlc"
ReportProject is my Application Name.
- sonj
|
|
|
|
|
Good Morning All
i have the Following SQl Procedure
<br />
USE [ValRollClients]<br />
GO<br />
<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
ALTER Proc [dbo].[CheckExistance]<br />
(<br />
@username varchar(50),<br />
@OldPassword varchar(50),<br />
@OutRes int Output<br />
)<br />
as <br />
set @OutRes =(select count(*) FROM Login WHERE <br />
Username = @username And UPassword = @OldPassword)<br />
<br />
in my Query analyzer i test it like this
<br />
declare @OutRes varchar(5)<br />
Exec [CheckExistance] 'vuyiswa','5555',@OutRes Output<br />
select @OutRes <br />
<br />
if the User Exists it gives me "1" and if not "0"
and i use this Procedure from Vb like this
<br />
con = New SqlConnection(strcon)<br />
<br />
cmdselect = New SqlCommand<br />
<br />
cmdselect.CommandTimeout = 0<br />
<br />
cmdselect.CommandType = CommandType.StoredProcedure<br />
<br />
cmdselect.CommandText = "CheckExistance"<br />
<br />
cmdselect.Connection = con<br />
<br />
cmdselect.Parameters.Add("@username", "Username")<br />
<br />
cmdselect.Parameters.Add("@OldPassword", "strPassword")<br />
<br />
cmdselect.Parameters.Add("@OutRes", SqlDbType.Int)<br />
<br />
cmdselect.Parameters("@OutRes").Direction = ParameterDirection.Output<br />
<br />
Dim bolres As Boolean<br />
<br />
Dim intRes As Integer<br />
<br />
Try<br />
con.Open()<br />
<br />
<br />
intRes = cmdselect.ExecuteScalar()<br />
<br />
intRes = cmdselect.Parameters("@OutRes").Value<br />
<br />
<br />
Select Case intRes<br />
Case 1<br />
bolres = True<br />
Case 0<br />
bolres = False<br />
<br />
End Select<br />
con.Close()<br />
<br />
Catch ex As SqlClient.SqlException<br />
<br />
MsgBox(ex.Message)<br />
<br />
End Try<br />
<br />
Return bolres<br />
<br />
<br />
but my Boolean value will be false, that means it always brings "0"
what is the Problem
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
The way I always do this, is to create the parameter so I have a variable that points to it, then set it's direction and finally add that parameter by passing in the variable. Then I check the value on the variable. not sure how that would make any difference, but my code always works.
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 )
|
|
|
|
|
Hi Chris
i did that, ok, i have change this line to be like this
<br />
<br />
cmdselect.ExecuteNonQuery()<br />
<br />
intRes = cmdselect.Parameters("@OutRes").Value<br />
<br />
As for my Stored Procedure will deliver me a value of "1" when a user is Found and
"0" when a user is not Found. and after this i pass the value returned by an OutPut variable to a integer variable and test it like this
<br />
Select Case intRes<br />
<br />
Case 1<br />
<br />
bolres = True<br />
<br />
Case 0<br />
<br />
bolres = False<br />
<br />
End Select<br />
<br />
now this will always give me "False", but My Procedure will give me "1" as its Supposed to be true.
I dont know whats wrong here
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
I guess you didn't understand me.
EIther way, it seems unlikely that what you wrote shouldn't work. Have you stepped through, grabbed the values being passed in, passed them to the stored proc, confirmed your code is connecting to the same database, and still got a different result ? Are you sure your proc sets the value of outres, and just just return 1 or 0 ?
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 )
|
|
|
|
|
Hi Chris
thanks again for your reply, again i have not assign values to my parameters. for me to Fix this i had to do the following
<br />
<br />
<br />
cmdselect.Parameters.Add("@username", "Username").Value = Username<br />
<br />
cmdselect.Parameters.Add("@OldPassword", "strPassword").Value = strPassword<br />
<br />
i was Supprised, how did i not see this
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswa wrote: Select Case intRes
Case 1
bolres = True
Case 0
bolres = False
End Select
Your code is always falling through to the latter case. Either add a break statement after bolres = true or use an if...else construct rather than a select case
|
|
|
|
|
I didn't spot that, b/c C# does not allow that and I assumed VB did the same ( but perhaps more sensibly didn't have a break keyword, if it always works that way anyhow )
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 was already developed crysatal report but i need how query pass to crystal report.now i am using vb.net and oracle
parthiban
|
|
|
|