|
Why Dave, he is counting nuts (well, that is the goal anyway). I don't think a fistful of nuts is going to outpace a modern PC, even when interfacing through the parallel port. I had earlier conversations with the guy and learned there is a hardware team and a software team for this, and a motor is involved (not sure how). Before you ask, he's on the software team.
|
|
|
|
|
Luc Pattyn wrote: I don't think a fistful of nuts is going to outpace a modern PC,
No, but the nut passing through the switch fast enough can make/break the connection faster than the poll can get the pin value. Of course, that's entirely dependant on production line speed and where/how the switch is placed. On top of that, what if two nuts are touching each other as they go through the switch? How many nuts went through the switch at once? Is his code going to account for the fact that it takes a variable amount of time for the nut to pass through the switch?
On top of that, why base the entire solution on a port that's dead and doesn't even come on PC's anymore? How long is this solution going to be used? Is there a spare parts plan in place to account for the dwindling supply of parallel port hardware over the life of the project?
I know, I'm nit-picking! But, having some manufacturing experience, I can't help but to think of these things because I've seen what can happen in the event of a detection failure. It can be deadly at one extreme and hillarious at the other!
|
|
|
|
|
I would guess the motor is there to power some gating mechanism that is assumed to let pass one nut at a time, some kind of revolving door (I think the French would call it a "tourniquet", not sure that is an English word though) but I wasn't presented any such information, so I can't be sure.
My very first response was to not use a parallel port, and to be careful about connecting anything to a port (voltages, currents, etc) but then he replied the hardware had been finalized and they now started looking to the software side. I do remember having seen lots of projects going awfully wrong when handled sequentially like that.
|
|
|
|
|
Luc Pattyn wrote: I do remember having seen lots of projects going awfully wrong when handled sequentially like that.
So have I. Ever been in an automotive prototype plant? It's pretty cool watching a paint robot paint itself and completely miss the body it's supposed to be painting!
|
|
|
|
|
How about two robots painting each other? Inspired by Escher[^]?
|
|
|
|
|
I am getting the error "Invalid column name" when i try to insert data into SQL Server Express 2008. I only get the error for the fields I put letters in. I don't get the error for the numeric fields. When I enter numbers in all of the fields the data import works fine so I know the column names are correct. The data type is set to VARCHAR for all of the columns so the field should accept letters also. I don't know what the problem is. Here is my code:
Dim myConnection As New SqlClient.SqlConnection
myConnection.ConnectionString = "Data Source=S10615-10\SQLEXPRESS;Initial Catalog=Assessment;Integrated Security=SSPI;"
Dim myCommand As SqlClient.SqlCommand
Dim strSQL As String
myConnection.Open()
strSQL = "INSERT INTO AssessmentPage1 (ClientName, DOB, MedicalRecords, MedicaidNumber, ConsumersName, MedicaidNumber1, ConsumersID, Clinicians, ParentsName, Address, Clinicians1, PhoneNumbers, DateofReferral, DateofAssessment, SchoolName, IdentifyingInformation, PresentingProblems, ReferralInformation) VALUES(" & TextBox1.Text & "," & TextBox2.Text & "," & TextBox3.Text & "," & TextBox4.Text & "," & TextBox5.Text & "," & TextBox6.Text & "," & TextBox7.Text & "," & TextBox8.Text & "," & TextBox9.Text & "," & TextBox10.Text & "," & TextBox11.Text & "," & TextBox12.Text & "," & TextBox13.Text & "," & TextBox14.Text & "," & TextBox15.Text & "," & TextBox16.Text & "," & TextBox17.Text & "," & TextBox18.Text & ")"
myCommand = New SqlClient.SqlCommand(strSQL, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
myCommand.Dispose()
myConnection.Dispose()
Any ideas would help. Im stuck in the mud here.
|
|
|
|
|
First, we, again, emplore you to drop the string concatentation technique and USE PARAMETERIZED QUERIES instead?
Why? Because you never would have run into this problem if you did.
The SqlParameter class would have properly formatted your data for each field. You're not enclosing the strings you are sending to the VarChar fields in your database in quotation marks, as required by SQL.
Your SQL has to look like this:
INSERT INTO myTable (someTextField) VALUES ("myStringData")
Your code is building the SQL statement like this, which doesn't work:
INSERT INTO myTable (someTextField) VALUES (myStringData)
Notice, the quote marks are missing. This is the problem you are running into.
Since you are also making the huge mistake of using text directly from TextBoxes and not validating any of it, you are opening yourself up to SQL Injection attacks as well as letting users put bad/unnormalized data into every field of your table.
|
|
|
|
|
This is exactly the same as the question you posted under the title "Incorrect syntax".
Posting the same question multiple times is generally frowned on here, especially when the question has already been answered.
|
|
|
|
|
Hi !
First, sorry for my bad english, but I'm french.
I try to understand how making a small "code editor" with a richTextBox and I'm currently working on the "line numbers column". I'm using a Panel and GDI for drawing the column and the numbers too because I want drawing them at the same height of the richTextBox line. I can draw them without problem, except when I st my RichTextBox "WordWrap" property at True.
When a line is too many long, she's "splited". I'm using "GetLineFromCharIndex(rtb.SelectionStart)" on "SelectionChanged". So, for example If Ihave 2 real lines, but the first is to many long. So I have 3 lines now.
When I click on the second part of the first line, this return "1" because for the RichTExtBox, the second part is a new Line.
But I want this return "0" ... I'm on the first "real line", not on the second one.
Is there a way to know when a line is splitted when WordWrap is True ?
|
|
|
|
|
I don't believe there is any way to get notified when one line is wrapped: I don't see an event that would report on it.
The easiest course would probably be to keep WordWrap off, and use a horizonal scrollbar; this is what Visual Studio does. The other alternative would be to build a custom RTF text box from scratch and raise an event when a wrap occurs.
|
|
|
|
|
If you really had to you could do something like
RichTextBox1.SuspendLayout()
RichTextBox1.WordWrap = false
RichTextBox1.GetLineFromCharIndex(rtb.SelectionStart)
RichTextBox1.WordWrap = true
RichTextBox1.ResumeLayout()
though it seems more like a work around...since GetLineFromCharIndex is really just supposed to tell you what line on the display the char is on, not the line in the text.
|
|
|
|
|
Hi William.
Thanks for your trick. This is no really my problem, but your piece of code will be usefull
My richTextBow is already in WordWrap = False. My problem is if the user write an hml Tag like this
<!-- GOOD -->
<div id="myID" class="myclass" />
<!-- False -->
<div id="myId"
class="myClass" />
Yes I could only check for start "<div" after="" the="" attributes="" and="" alone="" end="" tag="" "="">", but I don't think it's the best choice.
|
|
|
|
|
Well, with only the example you've provided, why not just check for the >? You could count how many occurred before the char you're checking.
|
|
|
|
|
I am having weird experience with the VBA (MS Access 2007) context sensitive setting for when I try to use it to get a property or method.
For example, I have a checkbox in my Access 2007 form. I want to do something simple like use context sensitivity to show the Value property of my checkbox:
<br />
myChkBox.Value = <br />
HOWEVER before I can finish typing "va", the context sensitivity stops and it won't allow me to auto-complete the word. MORE ANNOYING is the side effect when after i type in .Value and press space, the cursor then jumps back to the "e" in value and removes my space.
This is the same for other variables and objects:
<br />
dim bIsCheckSet as Boolean 'sometimes becomes bIsCheckSetas or bIsCheckSet asB<br />
the problem: context sensitivity (auto-complete) acting weird and seems to have a "time-out" period that is very short.
HELP!
|
|
|
|
|
I experienced this issue a while ago when the form was in Form View not Design View. Doing the coding while in Design View seemed to solve the problem for me.
|
|
|
|
|
thanks for the suggestion. it did not correct the whacked-out MS behavior i am seeing with auto-complete.
Symptom #3 (of many)
dim bMyBool as Boolean 'becomes dimb (if i wait too long after typing dim)
a short time-out period for auto-complete
Symptom #4 (of many)
Me. 'flashes list of properties/methods for Me, but disappears in 0.25 seconds
This is very annoying and counter productive to me - Microsoft products suck like 80% of the time.
BTW, is the topic i'm asking about called "auto-complete", "context-sensitive help", "type-ahead" ??
Thanks,
Johnny
|
|
|
|
|
I believe the word you're looking for is "Intellisense"
|
|
|
|
|
I'm about to rip Microsoft's balls off and shove them down their throat -- except MS doesn't have a pair!
This next symptom has me thru the roof!
If (expression) Then
(statements)
Else
(statements)
End If 'WTF - it breaks EndIF into two words End and If and i can't even save it as 1 word
|
|
|
|
|
john john mackey wrote: 'WTF - it breaks EndIF into two words End and If and i can't even save it as 1 word
That's because in VB syntax the end of an if block is End If not EndIf.
|
|
|
|
|
john john mackey wrote: This next symptom has me thru the roof!
That's because the End keyword works with other stuff, not just If , like End Sub , End Function , End Select , ...
john john mackey wrote: WTF - it breaks EndIF into two words End and If and i can't even save it as 1 word
If a single space character is driving you this nuts, you've got other issues to worry about...
|
|
|
|
|
I still want to feed MS their own body parts!
I guess I'm gonna reinstall. my latest complaint about my Access 2007, VBA is that when i (mistakenly) issued a search for a word while there were no code windows open, the VBA editor got frozen and was unresponsive to Cancel, any menu commands, and the Hour Glass icon just remained persistent.
So reinstall is what I think i will try next. I don't know what updates hosed over my Access, but now i'm just pissed.
the biggest annoyance/problem is:
defining variables, such as
dim bMyVar as Boolean
but having it appear as
dimbMyVar
dimb MyVar asBo
dim
MyVarasBo
|
|
|
|
|
yes, it does, and yet "Endif" (without space) is a reserved keyword and cannot be used as an identifier, e.g. for naming a variable. That is very basic for VB users.
|
|
|
|
|
Yeah, I was wrong on the whole "EndIf" "End" dilema. Sorry.
However, my problem was that Intellisense (or auto-complete, context-sensitive help) was all screwy in my VBA code so much so that I couldn't work
1. if i type to slow, the cursor jumps back to the end of the last character, removing spaces and as you can see, trying to define variables would run type and variable name together. :mad:
2. if i try to look up a property for an object, the list would disappear all too quickly. :confused:
Does this call for a re-install of Access 2007?
|
|
|
|
|
john john mackey wrote: Does this call for a re-install of Access 2007?
if it hinders your work continuously, I would certainly give that a try, without hoping too much.
I only ever did one Access+VBA project, more than 10 years ago; it was a simple application, about 3 forms, simple logic; I stumbled on dozens of bugs, each requiring newer versions, fixes, workarounds. I got it to work after lots of trouble, so I try not to do another one any time soon.
Good luck though.
|
|
|
|
|
how to add super script and subscript in VB and in SQL table?
|
|
|
|
|