|
You must have been reading the MSDN example for Recordset (looping to count number of instances) which I think is a very bad example.
Try to avoid looping through Recordset to get only specific record(s). In most cases it's much more efficient to modify your query to use SQL functions like COUNT, SUM, AVG, etc or specify a condition to get only the records you want.
Since I assume you only want to return one recordset, try modifying your SQL query into something like
"SELECT * FROM Email WHERE Notes LIKE '%" & strSearch & "%'"
You need the % as a wildcard for text before and after the search word(s).
This will return record(s) that match your query. If you only want one, use "SELECT TOP 1 * FROM..." instead.
If the recordset returns .EOF then there are no records found, otherwise simply display the data like this:
txtMessage.Text = rstNotes.Fields("FieldName")
I hope this helps
Edbert P.
Sydney, Australia.
|
|
|
|
|
Perfect That works great,
thank you for the help
|
|
|
|
|
Hi, i have a problem i an application i'm building in Visual Basic 2005 Beta 1, the thing is: when i try to update the access database, appears an error about some "InsertCommand" is missing, i'm using a code like the following:
Me.DVDsDataConnector.EndEdit()
Me.DVDsTableAdapter.update(Me.MyDVDCollection.DVDs)
and sometimes doesn't show the error but nothing happens, it doesn't update the database
what can i do?
|
|
|
|
|
You need to create the InsertCommand and assign it to your DataAdapter.
Basically this means you need to supply an SQL on how the data should be inserted into the database, e.g. "INSERT INTO DVD (DVDName) VALUES (@DVDName)".
You can use CommandBuilder to let .NET try to build an SQL script for you, but I recommend writing your own SQL so you know exactly what is changed in your database.
Have a look at this article[^] to find out more about InsertCommand.
I hope this helps
Edbert P.
Sydney, Australia.
|
|
|
|
|
Hello,
If I install Embedded Visual C++ on a machine that is already running Visual Studio .Net 2003, is there a possibility of something going wrong? (Would it damage the .Net CF in Visual Basic .Net 2003?)
Thanks
My sig:
"It isn't a bug, it's a feature I didn't know about." - Programmer2k4 (In case you didn't know - that's me! )
Oops, Programmer2k4 is now old...I should have thought about that a year in advance.
|
|
|
|
|
How can I get the SystemMenu Icons? The ones for Restore, Minimize, Maximize and Close?
Thanks,
Tim
|
|
|
|
|
mailing you one application which will extract all the system icons in the specified folder... check your mail with subject "mail from Rizwan"
Best Regards
Rizwan Bashir
Rizwan Bashir
|
|
|
|
|
Found the answer. They are actually part of the Marlett font.
|
|
|
|
|
Hi, I have some question related to my task in VB.NET. Those question are:
1. How to determine which row or value is select in a list view in VB.NET?
2. I have a button, I want it work when the user click on it, it would run a webpage (ex. when user click it point to www.codeproject.com) and open a default mail application to send mail to someone@codeproject.com.
3. How to create the splash screen in vb.net??? I try to use timer to close the current form (splash screen) and open the second form (the main form) but it display an error message. I used to do this method in VB6 and it is working very well. but I don't know who to do that in VB.Net after it raise a problem.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
The man from SCN-CO wrote:
1. How to determine which row or value is select in a list view in VB.NET?
Use the SelectedIndices and SelectedItems properties (as described in the documentation).
The man from SCN-CO wrote:
2. I have a button, I want it work when the user click on it, it would run a webpage (ex. when user click it point to www.codeproject.com) and open a default mail application to send mail to someone@codeproject.com.
Use the System.Diagnostics.Process class. These two calls will start the default application for internet browsing and sending mail, respectively:
Process.Start("http://www.codeproject.com")
Process.Start("mailto:someone@codeproject.com")
The man from SCN-CO wrote:
3. How to create the splash screen in vb.net???
Much has been written on this subject. I suggest googling for "VB.NET splash screen" and look through some of the samples.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Thank you very much for your comment. I will try it and if I have any problem I will let you know.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
i am creating a report with Access, i want to calculate the total time spend
for example x =Sum([Serv_Rec_Time_Spent])
x is 23:30 H for example, if i add 2 hours then x = 1:30 , instead of 25:30 hours
please i need help ASAP
|
|
|
|
|
in .net you can accomplish this pretty simply using the timespan structure.
Dim startTime As DateTime
Dim endTime As DateTime
Dim duration As TimeSpan
startTime = DateTime.Now
'--- code to generate your report, or any other process you want to time ---'
endTime = DateTime.Now
duration = endTime.Subtract(startTime)
hope this helps,
-jim
|
|
|
|
|
Well I am not calculating starting time and end time
For example I have 10 textbox each one has a different time
I just want to add them up so the total will not round up.
20:00 hours Plus 6:00 the total hours should be 26:00,
But coz it's time Elapsed, the total is 2:00 hours instead of 26:00 H
|
|
|
|
|
you can still use the timespan structure for this.
the only issue is that once you get above 24 hours, the hour portion of the time value is translated into a value representing a day/hour combination. in other words in your example above the resulting value would look like 1.02:00:00 meaning 1 day, 2 hours, 0 minutes, 0 seconds.
Dim timeOne As DateTime = DateTime.Parse("2004-01-14T12:00:00")
Dim timeTwo As DateTime = DateTime.Parse("2004-01-14T23:00:00")
Dim totalTime As TimeSpan
totalTime = New TimeSpan(timeOne.TimeOfDay.Ticks + timeTwo.TimeOfDay.Ticks)
messagebox.show(totaltime.tostring)
the result of this example would be 1.11:00:00 (1 day, 11 hours, 0 minutes, 0 seconds)
i don't know if this will work for you or not.
if you want to post some code maybe i can try to work something else out to help...
-jim
|
|
|
|
|
Hi Guru's,
How can i achieve this...............
There is a button on form1. On button clicking need to show form2 and close the form1(not to hide the form1)
Regards,
Ritesh
|
|
|
|
|
Well, the short answer is
form2.Show()
Me.Close() However, in reality it's not quite that simple. When you show your first form with Application.Run(New Form1()) , the lifetime of the application is tied to the lifetime of your form. There's an article[^] by Marc Clifton on this site that explains how to switch top-level forms using a custom application context.
Another approach is to start the application with an object that knows how to launch and close the forms in your application. To start with, it would show the initial "view" of your application (Form1) and, upon request, switch to a different "view", which could be closing form1 and opening form2 or opening forms 2 or three and closing form1 conditionally or whatever.
The second approach is infinitely more flexible, but it also requires more work to implement.
Charlie
if(!curlies){ return; }
|
|
|
|
|
in the Form1 , write this, attached to the Command1 button :
Sub Command1_Click()
Form2.Show
End Sub
in the Form2, write this :
Private Sub Form_Load()
Unload Form1
End Sub
aprx
|
|
|
|
|
Hi.
Is it possible to convert a bitmap held in memory to jpg, also held in memory?
|
|
|
|
|
Hi,
I assume ur bitmap is in form of array of bytes in that case u can convert it to jpg using...............
Dim wstWriter1 As New FileStream("c:\abc.jpg", FileMode.Create)
Dim bwWriter As New BinaryWriter(wstWriter1)
bwWriter.Write(pi_arrbyteFiles)
bw.close()
wstWriter1.close()
I hope this is what u want......................:->
regards,
Ritesh
|
|
|
|
|
Well not exactly….
I have bitmap in memory (byte array)
Now… I want to convert the bytes (the bitmap) to a jpg picture, without saving it to disk first.
Like using a codec
|
|
|
|
|
Hi (sorry for my english) - VB6 and W2K
I need a script for download CGI generated page to file. Actually using script from http://www.devx.com/vb2themax/Tip/19203 , but its unstable (returning err "-2147220504" and description "An error occurred calling InternetOpenUrl function"). Please recommend me a solution of this error or better script.
THX
|
|
|
|
|
Hello there
I have created one windows application which works like windows explorer. while browsing the folders in application when user opens any file like any text file . I create one thread for that(can open more then one file at the same time so cannot define the list of threads ). and when user close the application , the application do not stop due to the running thread(s) I kept a global array of threads but from there I can do every thing except stopping the thread.
Global array ::::: because user can open more then one files togather or one by one.
Can any one help me in this issue ????? to get the list of threads on one particular form and ability to close them or break them (so that user can keep working on text file even the application is closed)
The Code is
'Form Level Declaration
Dim th() As Thread
' Event Level... where Thread is created
Dim t As New Thread(AddressOf DisplayFile)
t.Start()
th(th.Length - 1) = t
ReDim Preserve th(th.Length + 1)
' On form Closing event
Dim count As Integer
For count = 0 To th.Length - 1
If Not th(count) Is Nothing Then
If th(count).ThreadState = ThreadState.Running Then
th(count).Abort()
th(count) = Nothing
End If
End If
Next
Rizwan Bashir
|
|
|
|
|
I think you should have done it like this:
' Event Level... where Thread is created
Dim t As New Thread(AddressOf DisplayFile)
t.Start()
ReDim Preserve th(th.Length + 1)
th(th.Length) = t
|
|
|
|
|
yes you are right.... I might miss typed here....
any ways with this change I am waiting for reposnse.
thanks
Rizwan Bashir
|
|
|
|