|
I can't tell from your post whether you have written code to access the serial port.
If you haven't then read up on the System.IO.Ports namespace and come back with specific problems in your code.
If you just want general help on the serial port and example code then a quick search on Google will get you started.
Alan.
|
|
|
|
|
Noufe wrote: As I am in need to stop reading the barcode scanner,please give me the code to stop (disable ) and enable the serial port.
First, write you own code. You don't disable the serial port. You simply close the port your opened. This will keep you from reading any more data on the port until you open it again.
Noufe wrote: I expect the detailed code, since I am beginner in this area of VB.Net
You "EXPECT"? Ballsy, real ballsy. Don't start making demands in a forum environment. Epsecially since you're not paying for support and we all volunteer our time here.
|
|
|
|
|
I need to use one report with subreport i am using .Net Reporting.
The report is working without parameter from Master report to Sub Report
But when i pass the parameter to sub Report then it Give Error.
Is There Any Example or Tips Then Thanks
Best Regards,
Chetan Patel
|
|
|
|
|
Copy and paste your report to Bin/Debug Folder for the latest copy of the report because the application is running from that folder
Best Regards,
Chetan Patel
|
|
|
|
|
Hi all
I am comming from VFP environment, and I work most of my project in VFP in addition to some project in vb6 and now in vb.net
In VFP there is no OPTION EXPLICIT, which mean There is no Strongly Type variable available so can code something like
oIE = Createobject("InternetExplorer.Application"
cName = "Soemthing"
cName = 10
The small "c" is for Character, "o" for Object, "c" tells that the variable cName is character type variable.
Since in vb6 and vb.net are strongly Typed language, I have 2 question
#1 Is it best practice to use Variable Naming? or that is not important?
#2 if yes, what is the best Variable Name Technique?
TIA
Samir R. Ibrahim
|
|
|
|
|
Adding Prefix is good practice.
In .net It is best if you give proper name like
DateOfBirth instead of DOB
Initail Capital
And add First caracter for DataType means
dtDateOfBirth
Best Regards,
Chetan Patel
|
|
|
|
|
Chetan Patel wrote: Initail Capital
And add First caracter for DataType means
dtDateOfBirth
Hi Chetan.
That looks like a good way to follow.
Is there is a list for what prefix I should use for all kind of variables type?
Samir R. Ibrahim
|
|
|
|
|
Using a prefix to specify an aspect of a variable is called hungarian notation. It was originally intended for more important aspects than the variable type, but in a language where strict typing is not available it's quite useful to use it for the variable type.
In VB.NET you should not only use OPTION EXPLICIT ON, but also OPTION STRICT ON. That protects you from doing unintended implicit conversions, like assigning a string to an integer variable.
As you then have strict typing, there isn't really any need to use hungarian notation to keep track of the data types. Don't clutter up the variable names with information that's not really needed. If you use hungarian notation you should use it for something that it was intended for in the beginning, like separating validated (safe) data from unvalidated (unsafe) data.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
umm. that is
I got 2 answer,
one says it is good practice and I should use it. I agree with him regarding my previous usage to this hungarian notation in VFP.
and your answer which say no need to use it in OPTION EXPLIXIT ON and OPTION STRICT ON environment unless in special cases. and I TOTALLY Agree with you.
Since using it and not using is not very important as in VFP.
Is using it considered Best Practice? (Just yes/No)
TIA
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: one says it is good practice and I should use it.
No, you shouldn't.
Samir Ibrahim wrote: Is using it considered Best Practice? (Just yes/No)
No. Not any more.
|
|
|
|
|
Thank you for the confirmation.
Samir R. Ibrahim
|
|
|
|
|
On the variable naming, it's a matter of preference really and if you can consistently get a group of devs to follow a standard. I've been in groups where everything is prefixed and in perfect Hungarian notation, and others where it was absolute chaos.
Any more if it's a project I'm doing solo, I use a 1 letter prefix on a value data types (Dim lCount as Long = 0L) and no prefix/notation with reference types; else I go with the flow and use whatever the standards are for the particular project/group.
Strict + Explicit = always ON.
My 2 cents... you ask 10 developers, expect 10 diff. answers - lol.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Jon_Boy wrote: On the variable naming, it's a matter of preference really
This is a golden sentence.
in vfp it is Best Practice. in vb6 or vb.net it is matter of preference
Jon_Boy wrote: My 2 cents... you ask 10 developers, expect 10 diff. answers - lol.
I will say if you ask 10 Developer, you will get 20 answer
I speak for my self when I am doing a large project is totally different from doing medium project and small project.
In large project I add my own prefixing to understand and quickly understand this variable, Public, Local, Private, where it came from (a form object, table, memory variable, reference, type, enum etc...
Where if you have lot of forms and lot of variable, and this variable should be public so the other variable in other form can take it is value.
end of line? in VFP I have 3 type of prefixing I follow.
In vb.net, I don't know yet if I will need that, since I am still in creating testing small projects (learning).
But from this thread (so far) I guess I will not.
Samir R. Ibrahim
|
|
|
|
|
Hi to All,
Here I come across a problem with CR.
When I run a specific query(joining two table) in MS access it works fine. But same query is repeating the resultant records twice. The query is as follows..
Dim qry1 As String = "SELECT distinct student.id, student.fname,student.lname, no_of_class_per_batch.no_of_class_held, student.no_of_class_att FROM (student INNER JOIN no_of_class_per_batch ON student.bid = no_of_class_per_batch.batch_id) where student.bid = '" & str & "'"
I am using vb.net2005 with Crystal Report.
Regards,
mahalakshmi
|
|
|
|
|
I am using Visual Basic 6.0 with MS Access in multiuser environment with DAO, I am trying to apply read lock on record, when the record is opened by another user, but not successful in doing so...Does any body know how this can be done what cursor type and lock type should be used for this purpose.
|
|
|
|
|
Why do you still use VB6 in 2009? Noone will asnwer you on that question. let me tell why i dont use VB6
Here are my reasons:
1. It will not be updated or supported by Microsoft
Microsoft has made it clear that they will not release any new versions of Classic VB either as part of Visual Studio .NET or standalone. Furthermore, they won’t be releasing new patches or fixes for it. This means that if a new security problem is found tomorrow the most likely advice Microsoft will give will be, “Upgrade to .NET to fix the problem.” No amount of complaints, unflattering press, online petitions will change this. .NET is where Microsoft wants Windows developers to be so that’s what they’re going to promote, come hell or high water.
2. It is outdated technology
As I mentioned above, VB6 was released in 1998. A lot has changed since then, particularly with the continued rise and importance of the Internet. Sure, there are a lot of things VB6 could do Web-wise but, unfortunately, there are newer tools, such as .NET, Ruby on Rails, and Java, that are new and/or have been updated to take advantage of the most recent trends while VB6 has languished.
Also, Windows has continued to change. With Vista, there are many things you have to do in order to use VB6 with it and to deploy VB6 apps to it that you didn’t have to do previously. Remember that when VB6 was released Windows 98 was brand new but now you would have to look around a lot to find systems still using it, particularly in businesses of any size. Changes to Windows promise only more troubles for VB6 applications going forward.
3. It is a career dead end
When you consider your career as a professional programmer you have to understand that not expanding your skill set beyond VB6 is a serious career limiting move. Fewer and fewer companies are hiring contractors and permanent employees for purely VB6 programming positions. And, to make matters worse, the positions that are available are often maintenance positions that offer little or no opportunity to develop new code. Instead developing new applications, you’re likely to be working on old, poorly written, applications that exhibit what I call the Winchester House effect from being patched and patched again by a legion of programmers over the years.
To make matters worse, these places are often unpleasant places to work, so much so that I’ve come to refer to them as “VB6 Ghettos”. You’ll often find them staffed with people who have little or no ambition to improve their skills, who jealously guard their ‘secret’ knowledge from you, and who are often lacking in application design skills. Nasty office politics reign supreme as people try to protect their position.
So those are my reasons why I think VB6 is dead as an application development tool for Windows programmers.
more info on the Death of VB read this
http://www.vb6.us/articles/microsofts-killing[^]
Hope it helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
The Lock Type
Imagine that, after creating a record set and working on it, you want to control who else can have access to the records of the set you are using. To exercise this control, you can create a "lock". This allows you, for example, to prevent other people from changing the records until you have finished with them. To support locking, the ADODB namespace is equipped with an enumeration named LockTypeEnum, which defines various options:
When a computer connects to a database, its user may need to make changes to various records at the same time, such as deleting a range of records or changing many records at the same time (such as giving a raise to many employees), instead of making one change, then another, then another. For this type of scenario, when the user accesses the records, instead of monopolizing them and waiting for the user to finish an operation that could take long, you can download the records on the user's computer, and disconnect the user from the database. The user would then make the necessary changes. When the user is ready to commit the changes, you can then reconnect to the data source and submit the changes. This type of lock is referred to as batch optimistic.
This lock is supported through the ADODB.LockTypeEnum.adLockBatchOptimistic value
You may have a database that a few different people access at the same time. If the database is small enough, which is the case for restricted environment, the likelihood of two people editing or updating the same record (at the same time) may be low. In this case, you can indicate that you want to lock the record only when necessary. In this case, you use what is referred to as optimistic locking.
This lock is implemented using the ADODB.LockTypeEnum.adLockOptimistic value
The above two options assume that you would lock many records to apply the indicated scenarios. If you prefer to lock one record at a time, you can use what is referred to as pessimistic locking.
This lock is done using the ADODB.LockTypeEnum.adLockPessimistic value
The above three scenarios allow a user to edit and/or update the records that are included in the set. In some cases, you may want to prevent any editing or update on the records while the set is being accessed. In this case, you can set the records to read-only.
This lock can be set using the ADODB.LockTypeEnum.adLockReadOnly value
If you don't want to specify the type of lock system to use on a record set, use the ADODB.LockTypeEnum.adLockUnspecified value, which is the default value. Otherwise, to specify the lock type, pass the desired value as the fourth argument to the RecordsetClass.Open() method. Here is an example:
Private Sub btnRecordset_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnRecordset.Click
Dim rstPeople As ADODB.RecordsetClass
Dim conADO As ADODB.ConnectionClass = New ADODB.ConnectionClass
rstPeople = New ADODB.Recordset
Dim fldEach As ADODB.Field
conADO.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='C:\Programs\People.mdb'", Nothing, Nothing, 0)
rstPeople.Open("Persons", _
conADO, _
ADODB.CursorTypeEnum.adOpenDynamic, _
ADODB.LockTypeEnum.adLockOptimistic)
rstPeople.Close()
End Sub
This uses the adLockOptimistic as the type of lock used on the recordset.
|
|
|
|
|
Though doing your own record locking has it's uses, it also has some very large pitfalls. Mainly, if your not VERY careful with the lock and only keep it in place as long as is minimumly necessary, you're in for some trouble.
First, most people who do this don't know what they're doing and just throw records locks around like mad and keeping them there for minutes at a time, sometimes longer. This can kill your app's performance and the database's and it'll destroy your app's scalability. Also, what happens when your app locks records in a table, then your app crashes?? How are the locks going to get released??
|
|
|
|
|
I am trying to filter fields in a table that contain percent (%) and apostrophe (') characters. I kow that to filter an apostrophe you need to add another apostrophe (''). However, when a text contains the percent (%) character in combination with an apostrophe (') character, an exception is thrown. Also, when using the % character in a filter string, it will be function as an "*" (fields starting or ending with). I need the % to be considered as a character whenever the % makes part of a string in the field. How can I address these issues?
The code below explains my question.
Dim TheTable As New DataTable
Dim col As New DataColumn("Col1")
TheTable.Columns.Add(col)
Dim TheRow As DataRow = TheTable.NewRow
TheRow("Col1") = "Filter me"
TheTable.Rows.Add(TheRow)
TheRow = TheTable.NewRow
TheRow("Col1") = "Filter me%"
TheTable.Rows.Add(TheRow)
TheRow = TheTable.NewRow
TheRow("Col1") = "Filter me'"
TheTable.Rows.Add(TheRow)
TheRow = TheTable.NewRow
TheRow("Col1") = "Filter me%'"
TheTable.Rows.Add(TheRow)
TheRow = TheTable.NewRow
Dim filteredrows() As DataRow
filteredrows = TheTable.Select("Col1 Like 'Filter me'")
MsgBox(filteredrows.Length)
'THE NEXT LINE WILL RETURN ALL RECORDS. I NEED ONLY THE RECORD ENDING WITH (OR CONTAINING) THE CHARACTER %
filteredrows = TheTable.Select("Col1 Like 'Filter me%'")
MsgBox(filteredrows.Length)
'THE NEXT LINE WILL RETURN TWO RECORDS (Filter me) and (Filter me'). I need it to return (Filter me') only
filteredrows = TheTable.Select("Col1 Like 'Filter me'''")
MsgBox(filteredrows.Length)
'THE NEXT LINE WILL THROW AND ERROR: "Error in Like operator: the string pattern 'Filter me%'' is invalid"
filteredrows = TheTable.Select("Col1 Like 'Filter me%'''")
MsgBox(filteredrows.Length)
|
|
|
|
|
To escape the %, so you are searching for a %, you will likely need to put brackets around the %. Placing a backslash before the % may also work, but I always go with the brackets. For example:
filteredrows = TheTable.Select("Col1 Like 'Filter me[%]'")
|
|
|
|
|
mbv800 wrote: 'THE NEXT LINE WILL RETURN ALL RECORDS. I NEED ONLY THE RECORD ENDING WITH (OR CONTAINING) THE CHARACTER %
filteredrows = TheTable.Select("Col1 Like 'Filter me%'")
You can use a character set for the % character:
Col1 Like 'Filter me[%]'
You can also use an escape character:
Col1 Like 'Filter me!%' escape '!'
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Some languages like C++ and Java have mode for the graphics object called XORmode.
This makes the rubber banding easier. You just set the XORmode for the graphics object and it does the work.
In VB 2008, yes, it could be done but it looks like it is several times more effort.
I hope I am missing something.
Please help.
Thanks,
Stefan
|
|
|
|
|
Microsoft has a How-to in this very issue-
http://support.microsoft.com/kb/71488[^]
Take a look. Good luck!
Ranjit Viswakumar
Professional Services Specialist
http://hostmysite.com/?utm_source=bb
|
|
|
|
|
That's not for VB 9, that's for VB 3!
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|