|
Hi I have a windows application with several textboxs for input.
I want my programme to be able to detect any changes in the textbox the user may make so that it will prompt the user to save the changes if they leave the form.
Does any know how to do this? Is there an isdirty method or function for this?
Any help is appreciated.
|
|
|
|
|
I usualy set a global var on the form that tracks a boolean value to signal if any of the data on the form has been changed. You can then set the value to true in any of the text boxes changed events. From here, any time you are going to close the form you check the dirty flag you have set up and see if it is true.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
Thanks. I have set an isdirty flag as a boolean. What i was looking for was an event for the textbox to detect the change which was the textchanged event. Everytime one of these events gets invoked, isdirty is set to true.
This works for me so thank you very much for your help.
|
|
|
|
|
I just installed .NET and find myself unable to run VB programs from the debugger. I wrote a little "Hello world" program and tried to run it, and the development environment crashed with an access violation. Anyone know how to fix a broken install? There does not seem to be any support from MS without paying hundreds of dollars.
|
|
|
|
|
Hi,
I want to write an app in VB.net that will go through lots of MP3 files and (quickly) detect the average sound level within the files, notifying someone should they be below a threshold.
I'm sure this must be possible using the .net framework, but would probably take me a week to code.
For this reason, I'm quite happy to use a com component.
Can anyone point me in the right direction?
Regards
Graham
|
|
|
|
|
glaidler wrote:
I want to write an app in VB.net that will go through lots of MP3 files and (quickly) detect the average sound level within the files, notifying someone should they be below a threshold.
I'm sure this must be possible using the .net framework, but would probably take me a week to code.
No need to work a week Just use my nBASS[^] lib, load each file in decode only mode and check the level. Now that is the easy (but ugly) way. Ideally you should write a DSP similar to a normalization DSP. There was questions about detecting silence on the BASS forums a while back that mite be usefull.
All in all, either way, it wont be quick.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Thanks for this.. Very impressed with the nBass assembly. I have loaded the relevant file into a stream object, but don't know how to analyse the level within the stream..
Should I be looking at GetData(buf, 0) method?
Graham
|
|
|
|
|
With Adodc3.Recordset
.MoveFirst
Do While Not .EOF
cPrice = DataGrid1.Columns("Price")
strProductCode = DataGrid1.Columns("ProductCode")
'updating the price table
Dim updateSQL As String
updateSQL = "Update Price set Price = " & cPrice & " " & _
" where PriceCode = '" & strPriceCode & "' " & _
" AND ProductCode = '" & strProductCode & "'"
Set RS = Conn.Execute(updateSQL)
.MoveNext
Loop
End With
the above is code i use to update a datagrid, the only column that is not locked in the datagrid is the price column and the only other piece of code that i think may affect it is a BeforeColUpdate function checking to see only numeric values are entered...is there anything i am doing wrong? it updates the prices fine in the database, is there any way i could catch it to degrade gracefully instead of crashing out? Thanks in advance!
|
|
|
|
|
I have one array with say 10 strings in it> i want to put a subset of these 10 strings that I will identify by name (but not by index) into another array.
So I want to say that if the origArray[i] is "a", or "m" or "l" then put this into my new array newArray() , otherwise keep looking into the old array till its exhausted..
Thanks
Appreciate your help,
ns
|
|
|
|
|
I would make the second array an ArrayList.
Dim origArray() As String = {"a", "b", "c", "d", "e", "f", "m", "z", "l"}
Dim secondArray As ArrayList = New ArrayList()
Dim i As Integer = 0
For i = 0 To (origArray.Length - 1)
Select Case origArray(i)
Case "a", "m", "l"
secondArray.Add(origArray(i).ToString)
Case Else
End Select
Next
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
Hello,
i want to change the mouse cursor (default to hand) when i am on the first column (only the first) of my datagrid.
i try this code and it don't work :
Private Sub DataGrid1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseMove
Dim hti As system.Windows.Forms.DataGrid.HitTestInfo
hti = DataGrid1.HitTest(e.X, e.Y)
If hti.Type = System.Windows.Forms.DataGrid.HitTestType.Cell Then
If hti.Column = 1 Then
DataGrid1.Cursor = System.Windows.Forms.Cursors.Hand
Cursor.Current = System.Windows.Forms.Cursors.Hand
End If
End If
End Sub
Thank you
|
|
|
|
|
Hi, I get a NullRefrence Exception with the following code. I've spent a week working on this and I still can't figure it out. The error only comes If I enter the wrong username or password.
Public Class Login<br />
Inherits System.Web.UI.Page<br />
<br />
Protected WithEvents btnLogin As System.Web.UI.WebControls.Button<br />
Protected WithEvents WrongPass as System.Web.UI.WebControls.Label<br />
Protected WithEvents tbPass as System.Web.UI.WebControls.textbox<br />
Protected WithEvents tbUsername as System.Web.UI.WebControls.textbox<br />
<br />
Private Sub btnLogin_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles btnLogin.Click<br />
if ValidateUser(tbUsername.Text,TbPass.Text) then<br />
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(tbUserName.Text, true)<br />
else<br />
WrongPass.Text = "You have entered the wrong username and or password"<br />
end if<br />
End Sub<br />
<br />
Private Function ValidateUser(ByVal uid As String, ByVal passwd As String) As Boolean<br />
try<br />
dim strConn as string = System.Configuration.ConfigurationSettings.AppSettings("ConnString")<br />
dim Conn as new System.Data.OleDb.OleDbConnection(strConn)<br />
<br />
dim cmd as System.Data.OleDb.OleDbCommand = new System.Data.OleDb.OleDbCommand("SELECT * from tblUsers where Username = '" & uid & "'", Conn)<br />
dim dr as System.Data.OleDb.OleDbDataReader<br />
<br />
Conn.Open()<br />
dr = cmd.ExecuteReader()<br />
While dr.Read()<br />
<br />
If String.Compare(dr("Password").ToString(),passwd,False)=0 Then<br />
Conn.Close()<br />
Return True<br />
else<br />
Conn.Close()<br />
Return False<br />
<br />
End If<br />
End While<br />
catch ex as System.Exception<br />
end try<br />
End Function<br />
<br />
<br />
End Class
The stack is:
[NullReferenceException: Object reference not set to an instance of an object.]
Login.btnLogin_Click(Object sender, EventArgs e) +118
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1252
Thank you for your help.
|
|
|
|
|
Hi. If making an app where user compiles quotes from various docs on his own hard drive, how can we get the app to automatically find and include the source of each quote by full pathname? We are building with Visual Basic. Please help ASAP if you can. Thanks!
-Mystified
|
|
|
|
|
I have a problem, I need to run a series of little tasks. There are only about 4 types of task but they can be run against a number of databases. The exact number of instances of each task are unknown until run time.
I could run all these tasks sequntially but this may take sometime and one or more may fail or timeout extending the runtime to collect all the data.
So the obvious thing is to multithread, dynamically creating the threads and holding them in an array or collection. Most of this seems fairly easy, but the main problem I have is with handling any events e.g. successful termination. I can declare events for the class this is not a problem but to actually handle the event I have to specify a SUB to handle each specific instance .e.g.
Sub TermEventHandler (ByVal intResult as Integer) Handles specific_instance.TermEvent
This is of course impossible as the instance does not exist at compile time.
What I need is a way of having just one SUB to handle all instances of a particular thread types TermEvent.
I'm sure there must be a sensible way of doing this, but being a relative newbie to this I can't see it.
I hope I have explained my problem in terms people can understand.
If anyone could suggest a way out of this I would be grateful. Thanks
|
|
|
|
|
What i understood is that you want to create a different sub to handle each thread's events...
if this is true.. I just ask why ?
i think one handler is enough but you need to make some kind of synchronization
search msdn for critical sections , mutex , etc.
|
|
|
|
|
Thanks for the reply, maybe I wasnt too clear on my original statement. Its not that I want to handle each event seperately, it was that, I did not know how 1) make a sub handle more than one event and 2) how you do this when creating a thread from scratch.
As it happens I found some thing on another site last night that showed me all I needed, I now understand a little more about dynamically creating objects and hooking things up to them etc. I did say that I was a newbie to all this .
I'll include what I found just in case anyone else is interested
1) you can say
Sub TermEventHandler (ByVal intResult as Integer) Handles specific_instance.TermEvent anotherinstance.Termevent ...
2) To hook up the event dynamically
AddHandler specific_instance.TermEvent, Addressof TermEventHandler
|
|
|
|
|
I have created a custom control in .NET and registered it with COM
interprop so as I could use it in a VB6 application. The control
contains a text box within it and when the control looses focus the
text box disappears. When I then double click on the control then the
text box reappears.
I can get the control to work by using the following code in VB6
Private ctrlExtra As VBControlExtender
Set ctrlExtra = Me.Controls.Add("TestControl.TestControl", "myCtrl")
ctrlExtra.Visible = True
If anyone can help with this then I will be truly greatful.
Martin Stevenson
|
|
|
|
|
I want to display a tree structure with the help of treeview control.My data is stored in database.It takes much time to retrive data from database and show it in treeview control.
Can i use XML to build the tree and show in the treeview control.If yes please tell me how with source code
|
|
|
|
|
Hi
I was wondering how I would be able to run an .exe file from within a function.
Thanks
Nitin
|
|
|
|
|
You can use the Shell function :
l_vRetVal = Shell(_your_exe_path_and_name", vbNormalFocus)
This will asynchronously run the given .exe file.
Have a look in the MSDN to understand the meaning of vbNormalFocus and to know the other possibilites.
If you don't want to run it asynchronously (ie : you want the your function waits until the exe is finished), you'll have to create a process. If you need, I can give you more infos on that.
Jerome
|
|
|
|
|
An even simpler (and apparently more thread-safe for some reason that someone once told me that I can't remember!) is to use ShellExecute function - use the API viewer to get the VB prototype
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hi...I have constructed several Master-Detail forms using
the data wizard in vb.net. Most of the time, but not
always, a user will be entering data into the datagrid and
an extra row appears, like magic, below the row they are
working on and it will have a duplicate of the information in the
row above it. But the data is not really there!
Anyone know what this is ????? Also they
have to do an 'update' on each row. Is there anyway for
them to be able to enter two rows of data and then do the
update? Also I end up with many concurrency errors and
foriegn key problems...any advice....Thanks in advance.
Thanks,
Mike
|
|
|
|
|
It's hard to tell without any code, but maybe you are having a problem known as "cross product join", where your join condition on the master/detail query is flawed and makes the SQL Server returns multiple combinations of results.
As a sample, imagine two tables where they must be joined by the fields A and B. If, in your join condition, you forget to specify one of them, this can lead this kind of problem. Another situation is forgeting to specify a join condition for a table used on a query.
I see dumb people
|
|
|
|
|
Hi Daniel...Thanks for the reply to my post. I can either put the code in a reply or email it to you if you're curious - I ask because it is a couple thousand lines of code generated by the data wizard. If you had a suggestion of what specifically to look for, I could copy and paste it to a reply. On another note, do you know if you can 'update' (uses a merge I believe) more than one row at a time? Again thanks. Mike
Thanks,
Mike
|
|
|
|
|
Hello people =)
I want to take a selected row from a ListView and transfer the information to TextBoxes or Labels. How do I do it?
/Marcus
|
|
|
|