|
The way I do it, is to keep a boolean variable that is initially set to False. When the user closes the screen using the button I want them to use, I set it to true in the Button_Click event before calling the close or exit statement. Then in the Form_Closing event I cancel the close if the boolean is not True.
There might be another way...perhaps looking at the sender parm?
|
|
|
|
|
Ahhhh... very clever, I like it.
Thanks
|
|
|
|
|
If you hook into the FormClosing event, there's a FormClosingEventArgs parameter which has a CloseReason property. The CloseReason property is a value from the CloseReason enumeration; if the user closes the application this property will be CloseReason.UserClosing
Alternatively, you could override WndProc; check which message gets sent when you click the close button
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
dim str1 as string
dim str2 as string
dim str3 as string
I have a string "Name1 Name2 Name3" and want to do this
str1=Name1
str2=Name2
str3=Name3
how make this?
|
|
|
|
|
This assumes that you will always have exactly three names in the string:
Dim strWithNames as String = "Name1 Name2 Name3"
Dim sa() as String 'Creates a string array
sa = strWithNames.Split(" ") 'Splits string on space
Dim str1 as String = sa(0)
Dim str2 as String = sa(2)
Dim str3 as String = sa(3)
|
|
|
|
|
|
Are you talking about splitting your string, based on spaces?
Dim nameString As String = "Name1 Name2 Name3"
Dim names() As String = nameString.Split(" ")
|
|
|
|
|
Dear Reader/Developer,
I want to develop a stand alone digital dashboard application to present live data from input coming into the computer ports (e.g. USB, serial or parallel port). The data is of an engineering type (e.g. volumes, mass, loads, velocity, etc).
1) What technologies do you recommend I use? (I am keen to learn what ever is required - I currently have an understanding of VB.NET and C#.NET).
2) Do you have any source code?
3) Which port would you recommend I use and why?
4) Which platform (i.e. a Windows form or internet browser application) would you recommend and why?
The final application will be running in a hostile and stand-alone environment, so I need to ensure the solution is simple and robust.
Notes:
1) I have spent a considerable amount of time searching and trolling Google pages with little definitive success. However I did find that there were several different approaches to developing digital dashboards so I am left wondering which one is the most robust approach for my problem?
2)I do not have a large budget to purchase one of the many digital dash boards development suites that are out there at huge cost.
3) This is definitely not a homework task - it is simply a genuine enquiry to gauge how best to approach this problem.
Thank you for reading and considering this question,
Regards,
Christopher (Sciencez)
modified on Thursday, June 4, 2009 2:49 PM
|
|
|
|
|
Sciencez wrote: 1) What technologies do you recommend?
Can be done in a lot of technoligies. Which one are you familiar with?
Sciencez wrote: 2) Can you provide the source code?
No. Its not my job.
Sciencez wrote: 3) Do you have some source code in C# or VB to access a port?
No. But Google surely has. Search it.
Sciencez wrote: 3) Which platform (i.e. a Windows form or I'net browser application) would you recommend and why?
I don't exactly seem to understand your requirements. But a mention of "live data" suggests to create a service to me.
जय हिंद
|
|
|
|
|
Thank you for taking the time to read my question. I am not sure that you provided any real new information. I was looking for two types of answers;
1) An answer from a person with computer interfacing experience who understands the riggers of data collection in a hostile environment (e.g. one with limited resources and difficult environmental conditions) where there is no access to the internet and the need to have a simple and stable application. Such a person would be able to suggest a broad approach to the solution (i.e. technologies to use etc.) and say why such an approach is a good idea (based on experience) - after all there is little to be gained from re-inventing the wheel!!.
2) An answer that provided specific solutions (with source code). You might be interested to know that I have already received one such answer that addressed a particular part of the issue/problem aforementioned.
In response to your answer to part 2 of my question (i.e. "No. Its not my job.") - I thought (and still believe) that this forum was for people with detailed knowledge and/or expertise in a particular area to assist others (who have different knowledge or expertise) to address issues that they are struggling with (or wish to learn more about) - your response suggests that you see it otherwise. If we all assist each other (especially in these difficult economic times) we all survive and progress.
Thank you again for taking the time to read my question.
Sincerely
Sciencez
|
|
|
|
|
Sciencez wrote: 1) An answer from a person with computer interfacing experience who understands the riggers of data collection in a hostile environment (e.g. one with limited resources and difficult environmental conditions) where there is no access to the internet and the need to have a simple and stable application. Such a person would be able to suggest a broad approach to the solution (i.e. technologies to use etc.) and say why such an approach is a good idea (based on experience) - after all there is little to be gained from re-inventing the wheel!!.
Sounds like a homework question to me. You might start to get some overly hostile responses with dumb posts like this.
Sciencez wrote: 2) An answer that provided specific solutions (with source code).
Sorry. I got my degree years ago and NO, I won't do your homework/work for you. Feel free to search CodeProject for tutorials and post back any specific questions with your current code.
Sciencez wrote: You might be interested to know that I have already received one such answer that addressed a particular part of the issue/problem aforementioned.
Good for you. God forbid you attempt to do it with your own free will.
Cheers...........hopefully we've helped you out a little.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Dear Jon_Boy,
"Sounds like a homework question to me. You might start to get some overly hostile responses with dumb posts like this."
This is definitely NOT a "homework question" - I must apologise profusely if it sounds like one and also if this post is construed as a "dump post".
"Sorry. I got my degree years ago and NO, I won't do your homework/work for you. Feel free to search CodeProject for tutorials and post back any specific questions with your current code."
I tried to be explicit and detail exactly what I was trying to achieve. You might be interested to know that;
1) I spent several hours searching/trolling Google.
2) I also spent quite some time searching CodePoject.
3) I was hoping to find some guidance as to an overall approach to take for this problem, so that I could go away and learn the required technologies. I currently have an understanding of VB an C#, but it is many years since I was employed as a professional programmer (like you I have a degree in computing) so I am a little behind the "8-ball" when it comes to the latest technologies etc, hence why I sort the advise of the experts, - I was not seeking the entire solution just guidance on how to best approach this problem.
Thank you again for your input.
Regards,
Sciencez
|
|
|
|
|
Sciencez wrote: 2) An answer that provided specific solutions (with source code). You might be interested to know that I have already received one such answer that addressed a particular part of the issue/problem aforementioned.
I cannot see any source code in that post. Can you?
Sciencez wrote: I thought (and still believe) that this forum was for people with detailed knowledge and/or expertise in a particular area to assist others (who have different knowledge or expertise) to address issues that they are struggling with (or wish to learn more about) - your response suggests that you see it otherwise.
Offcourse it is. But it is not a plcae where you can expect someone else to write code for you. You have asked for the source code and no one will do that for you atleast here. If you can show what you have tried and where do you struggle then there will be many to help you out.
जय हिंद
|
|
|
|
|
If you know how the data is transferred over the ports, then you could use inportb and outportb to read and write data to raw ports. I'm not certain how Windows exposes these through the API though - presumably something in kernel32.dll
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
hi all ,
well , i have invoice form separated into 2 parts the upper part is master (header) and detail (body) in invoices where header contains date,name,invoice number,etc ..and the lower part is the body contains the datagridview with its details like the item name or code,qty,price,discount,etc ..
the problem is i want to save the invoice headers in a table and the body in another different table but with a realtion between the 2 of them by the invoice id i think i put it in the invoices' form load. but i cant get it right .
so if any one have an example by code 2 solve this prob , please send .
by the way iam using vb. net 2005 and my db is sql 2005.
thanx all .
|
|
|
|
|
People who use these forums get a bit upset when people post requests for them to just do work. Why don't you post YOUR code, tell us why it isn't working and what error messages you are getting, and we'll try to help you.
|
|
|
|
|
|
I have a listbox and a button, and whenever I press that button, it's supposed to delete the selected row in the SQL database by the ID. The ID is the primary key.
Dim sqlconn As New SqlClient.SqlConnection
sqlconn.ConnectionString = "Server=[Removed];Database=erik_asp;Uid=asp;Pwd=[Removed];"
Try
sqlconn.Open()
Catch ex As Exception
MsgBox("Could not connect!", MsgBoxStyle.Critical, "Connection Error!")
End Try
If sqlconn.State = 1 Then
Dim sqlremovedata As New SqlCommand( _
"DELETE FROM [Team] ([ID]) VALUES ('" & ListBox1.SelectedIndex & "')", sqlconn)
sqlremovedata.ExecuteNonQuery()
MsgBox("Deleted successfully!", MsgBoxStyle.Information, "Record Deleted!")
sqlconn.Close()
End If
End Sub
It throws this error which I can't figure out what I did wrong:
Line 1: Incorrect syntax near '('.
modified on Thursday, June 4, 2009 9:07 AM
|
|
|
|
|
Your SQL statement is wrong. You may want to lookup the syntax for the DELETE statement. It should be:
DELETE FROM Team WHERE ID = ...
I highly discourage using string concatenation to build an SQL query like this. Google for "SQL Injection Attack" to see why and for example on using a parameterized query that is safer and easier to debug.
By the way, thank you very much for exposing one of your SQL Server's usernames and passwords to everyone on the ENTIRE INTERNET!
|
|
|
|
|
Dave Kreskowiak wrote: thank you very much for exposing one of your SQL Server's usernames and passwords to everyone on the ENTIRE INTERNET!
Ha!
|
|
|
|
|
I'm not concerned about it, as it's public anyway, not much you can really do to somehow affect my server.
The password is changed frequently also.
Also, I'm not really worried about SQL Injection as only my trusted friends are going to be able to have access to this application.
|
|
|
|
|
eginteractive wrote: Also, I'm not really worried about SQL Injection as only my trusted friends are going to be able to have access to this application.
You are a trusting soul. That's so nice to see these days.
Jon
Smith & Wesson: The original point and click interface
Both democrats and republicans are playing for the same team and it's not us. - Chris Austin
|
|
|
|
|
IMO you are underestimating the skills of a lot of folks out there.
जय हिंद
|
|
|
|
|
You have mixed SQL insert and delete statements. Check the syntax for delete.
जय हिंद
|
|
|
|
|
Confused on what's borked with your SQL command?
1. Run profiler and see what's being sent to the server. Copy and paste that command into a query window in SQL Management Studio. Fix it until its right and reflect the changes in VB.
2. OR get the command.commandtext and paste that into the query window.
Easy to find and easy to fix. If your statement doesn't work in SQL natively, it will never work from VB.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|