PlausiblyDamp
Administrators-
Posts
7016 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by PlausiblyDamp
-
Serial Ports Communication (Ports dont show up)
PlausiblyDamp replied to andicom's topic in Windows Forms
In your code you are only adding the ports to the combobox if it is already open (If myPort.IsOpen = True Then), this is probably filtering out the actual port as it won't be open at this point in your application. -
Serial Ports Communication (Ports dont show up)
PlausiblyDamp replied to andicom's topic in Windows Forms
If you try the sample code from http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.getportnames.aspx#Y675 does anything get listed to the console? -
Serial Ports Communication (Ports dont show up)
PlausiblyDamp replied to andicom's topic in Windows Forms
If you want to include the files in question then you can simply attach them to this post, for the source code just delete the bin and obj folders, zip it up and attach directly to this post. Images can also be attached directly here. Linking to external sites means in future the file may be unavailable and people reading this post in the future will not have access to them. If you run the application under Visual Studio's debugger which line of code does it break on? Does the call to IO.Ports.SerialPort.GetPortNames return anything? -
Serial Ports Communication (Ports dont show up)
PlausiblyDamp replied to andicom's topic in Windows Forms
Given the link was to a .rar file that contained several binaries (.exe etc) I didn't actually look at or execute anything in there.... Which line is the one throwing the error? What exactly was the error in question? Does windows itself report you has having any COM ports? If so does it give any details about the type or settings? Are the settings used in your application the same as the port itself? -
I'll take your word on that as I'm still not entirely sure what your original problem was or how Extenstion methods directly compare to .ToString() either.
-
I'm not really understanding what you are trying to do? I can't see exactly what the connection between MyStructure.Value.MYOWNMETHOD2 and MyStructure.Name = MYOWNMETHOD1("Hello") is. Could you give an example of what you are after?
-
One possible technique is the use of resource files, these can either be created directly (just add them as a file) when you need to store things like images, strings etc on a locale by locale basis. A form can also have these auto generated - if you create the basic form and then select it in the designer there is a property called Localizable, if you set this to true then Visual Studio does some work that Visual Basic chooses to hide :( If you are using VB then you will need to get it to display all files; At the top of the solution explorer there is a button to "show all files" if you select this there should be a little triangle symbol next to the .vb file, expand this and you should see two files a .designer.vb and a .resx - if you open the resx you will see it contains all the strings and positions for the UI elements. This is now effectively the default language for the form. If you are using C# then these should be visible by default. To support additional languages you can then select the form again and in the property grid look for a property called Language which should be set to 'Default' - if you wish to support say Spanish then simply select this from the list. If you now make changes to the UI you should notice an additional file called .es.resx is created - this will contain all the Spanish text etc for the form. This should then set the correct culture based on the user's locale settings, or if you wish to handle it manually then in the application start up you can deliberately force the culture... I have attached a simple app that should show you the principle working, if you look in the program.cs file you should see me forcing the UI culture and the code culture to spanish... WindowsFormsApplication1.zip
-
A couple of quick things to start, as you are using .Net rather than the Format command it might be easier to use .ToString() (or an appropriate overload) to get the date formatted as a string. You could get the same string from the date by using Date.Now.ToString("HH:mm:ss"). One other thing you might want to try is avoiding building SQL strings by using string concatenation - it can lead to errors due to data type mismatches as well as making the code itself harder to read and debug. http://www.xtremedotnettalk.com/showthread.php?p=463520#post463520 might be worth a read to give you a pointer on the topic.
-
Properties description in properties window
PlausiblyDamp replied to Doggo120's topic in Windows Forms
The two attributes you are after are http://msdn.microsoft.com/en-us/library/system.componentmodel.categoryattribute.aspx and http://msdn.microsoft.com/en-us/library/system.componentmodel.descriptionattribute.aspx -
I would say all of them unless you have a bloody good reason to allow a user to choose a code page (in all honesty do your users know what a code page is? Do they care?) Unless the people receiving the email have a client that can only accept a particular character set then there is probably no real reason to care about this and allowing users to make a selection will simply give them the chance to choose a wrong one. Just about any mail client in use these days will support some flavour of Unicode (UTF-8 at the very least) which should work just fine, in all honesty I would expect any mail client written in the past 5 or 10 years to support Unicode, the though that there are new clients that don't support Unicode saddens me.
-
Just because there is a property that can have values set doesn't mean you need to give the end user the ability to set it to all possible values, or any value at all. The operating system or bitness of the system doesn't make a difference to a code page, a code page is simply a way of encoding non ASCII characters into an ANSI character set. The easiest answer to this is use a unicode one like UTF-8 and try to pretend code pages don't exist any more.
-
You could probably try using a TcpClient to open a connection to the correct port and see if it connects, if it fails to open then the server is probably offline.
-
A ping request simply checks if there is something active on the specified IP address, there really isn't the concept of pinging a port. If the ping request succeeds you could try opening a connection on the specified port and see if anything accepts.
-
IIRC the .Receive method will read whatever response the server has sent so far, if you call it while the server is still streaming data then you will only get a partial result. You would need to keep looping until the call to .Receive returns 0 as this means there was no data lft to be read. http://msdn.microsoft.com/en-us/library/26f591ax.aspx#Y1200 has an example of what would be needed.
-
I need multiple PCs to connect to a single device over TCP.
PlausiblyDamp replied to TexasAggie's topic in Network
Without knowing more about the device this is going to be difficult to diagnose... Does the device support multiple simultaneous connections? When a client accesses this device is is properly closing it's connection when it has completed it's work? -
If the controls in question are inside of another container then you would need to loop over the container's control collection rather than the form's control collection. If these controls are nested inside of multiple containers then you might find it easier to write a routine that searches recursively through the controls.
-
Could you elaborate on what the problem is? Is it throwing an error or simply failing to change the colour correct? Is something else happening?
-
4.0 is the latest, it is part of .Net 4. The next version due out is going to be 4.5 and will be part of the next version of .Net.
-
Searching and then copying text from rich text boxes
PlausiblyDamp replied to 04jfw080694's topic in General
http://htmlagilitypack.codeplex.com/ is probably your best bet, it will allow you to parse and extract information from an html page and there are plenty of examples on the site itself. Be aware that even with a decent tool this is still a fairly error prone and fiddly process, plus you are going to be caught out if the html format used ever changes. In most cases it might be easier to see if the owner of the site in question has a public, documented way of getting to this information. -
You might want to switch from using the Collection class to a more modern replacement such as List(Of ...) e.g. Dim colProducts As List(Of Product) = New List(Of Product) then in the final line you could do something like colProducts("pPrice").ProductPrice However if you are just returning a single price from a single product then you can probably simplify the code considerably as there is no need for a collection of products to return a single product price. e.g. Public Function priceLookUp(ByVal pName As String) as Decimal Dim SQL As String = "select pPrice from product where pName = '" & pName & "'" Dim dtProducts As DataTable = myData.getData(SQL) Dim drRow As DataRow = dtProducts.Rows(0) Return DirectCast( drRow("pPrice"), Decimal) End Function That might not be perfect as I don't have VB on this PC at the moment but it should get you started.
-
http://msdn.microsoft.com/en-us/library/system.web.configuration.webconfigurationmanager.aspx is probably what you are after if you are using the web.config file.