|
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
|
|
|
|
|
Hi,
For example, if your listview (lswMyListView) has two columns, and you want to transfer the selected row into two textbox (txtColumn1 and txtColumn2) you have to do that (for instance, in the lswMyListView_Click procedure) :
txtColumn1.Text=lswMyListView.SelectedItem.Text
txtColumn2.Text=lswMyListView.SelectedItem.Subitems(1)
Hope this helps !
Jerome
|
|
|
|
|
Hi
I am having a problem assigning a date to a date field in an Access database using VB. I know how to do it using a string.
Dim stLinkCriteria As String
stLinkCriteria = "[Name] = 'whatever'"
Do I somehow use the #'s ?
Thanks
Nitin
|
|
|
|
|
try...
Dim strLinkCriteria as String
strLinkCriteria = "MyDate = #" & Me.ctlWhatever & "#"
the principle being that 1) any string that can be evaluated as a date, and 2) is enclosed in #'s, will 3) be evaluated as a date, so if Me.ctlWhatever.Value = "2/28/03" then...
strLinkCriteria = "MyDate = #2/28/03#" 'm/d/yy
no matter where you go, there you are
|
|
|
|
|
dear all,
how can i unload a Form from the Form_Load event
if i use Unload me , i get an error Object Unloaded
plz. help
|
|
|
|
|
Hi !
I guess this won't help, but I tried to do this :
Private Sub Form_Load()
MsgBox "Hi !"
Unload Me
End Sub
and everything works fine.
Are you doing something special into the Form_Load event ?
Jerome
|
|
|
|
|
i'm checking the existence of previous instance of my app using following code
If App.PrevInstance Then
MsgBox "An Instance Of The Application Is Already Running!", vbCritical, "Already Running"
SetForegroundWindow
End
End If
it is working alright
but i was pondering over 2 scenarios
1) if i use unload me instead of End then the msgbox comes as if it is in an infinite loop (keeps popping up when i press OK)
2) if a prev instance is running, i want the running application to get on top of all windows.
i know i've to use SetForegroundWindow, but i've no clue waht to pass in the parameter
any help will be appreciated
thanx in adv
|
|
|
|