well i have got a problemo with my client/server application....."My server evaluates two variables "data1" and "data2" and then uses the command "winsock.sendData(data1)" and "winsock.sendData(data2)" to send the data to client application but the problem is that i want my client to handle these two data arrivals differently......
What error handling should be used in VB.NET? Should one use the "On Error Goto ErrorHandler Exit Sub ErrHandler ... End Sub" pattern or should you use the "try {... } catch {...} finally {... }" pattern?
I'm trying to develop an app that will let me manage all my domain names through enom and I'm getting stuck here. I'm up to the point where I can get a response from the server but I'm not sure how to grab just the responses I need to get my app to do what I want it to do. In this example, I'm looking to grab just the "RRPText" response from their servers in VB, you can see below what responses I'm getting:
I'm calling the SQLDMO 8.0 COM library from VB.NET (using a PIA I generated with tlbimp) in order to backup a database with percentage completion notification:
Dim server As SQLDMO.SQLServer = Nothing Dim backup As SQLDMO.Backup = Nothing Dim restore As SQLDMO.Restore = Nothing Dim backupAbortable As Boolean Dim restoreAbortable As Boolean
I have been having an error that DBNull cannot be returned as a String and after hunting around I came up with the folowing but have had no sucess. it is very inportant that this code can handle DBNull as it will encounter this often.
What would be the best options to handle images in .Net 3.5 framework and SQL Server for a WINAPP that is incorporated with WCF? I need use this images for transactions inside the system.
i trying to make some code to handle the F12 key , or any other function key but it's not working. i tried with the 'enter' key and that is working fine
Private Sub ComboBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then e.Handled = True
I heard that there is two way to handle SMS for programming. One is to purchase a GSM Modem 2nd is to use 3rd party online web service.Which is the recommended one if I plan to implement the program in VB.Net and send the message internationally. As I have a function that is require to send sms where it reach certain times, so I most probably will need some API to do that.
I'm completely confused about the event handling. I read some articles about it but after it I just get confused to write and use them in my classes.This is my class i. e.:
[Code]..
I dont have any argument passing. But I want to know how should I do it too. And I wanted to know if each instance of the Test class, run this event separately I mean each instance by themselves, This event AnEvent() will occur? Cuz I have lots of instances from my class.
I am developing a COM dll library, and I have a little vb.net (vs 2005) application just to test it.I had my object declared in the application as
Private m_VarName As MyLib.CMyComClass
So far, so good.But now, I need an event to inform the application of some things, so I implemented such event in the COM dll, and changed the declaration to
Private WithEvents m_VarName As MyLib.CMyComClass
So far, so good, again. But if I add a Sub to handle my event:
Private Sub m_VarName_OnCaptureStop() Handles m_VarName.MyEvent .. End Sub
The first time I create the object, nothing bad happens, but if I reinstantiate it
If (Not m_VarName Is Nothing) Then ReleaseComObject(m_VarName) m_VarName= New MyLib.CMyComClass
then I get a cryptic TargetInvocationException, seemingly related to reflection (which, AFAIK, I am not using).If I remove the "Handles m_VarName.MyEvent" part, everything seems to work. In case it matters, I am not firing any event, for now.
I'm trying to see if Codedom can handle strings and concantination between different languages, without me setting up conditional strings per language.For example, I need to generate the following exactly as shown below in both C# and VB.NET via Codedom:
C# errorMsg = errorMsg.Replace('"', ''').Replace(" ", @" "); System.Windows.Browser.HtmlPage.Window.Eval("throw new Error("Unhandled Error in Silverlight Application " + errorMsg + "");");
[code]....
The CodeMethodInvokeExpression for errorMsg.Replace and System.Windows.Browser.HtmlPage.Window.Eval is simple enough, it's the string inside them that I can't figure out if Codedom can automatically handle.
I am writing an application in vb 2010. The design of a program should be work in this way. Let's take an example.
ROW TYPE 1 APPLE 2 Orange 3 Grape.
Currently, i have a column named 'row' to control the display order for each item. i will sort the 'row' colum in order to display the record in the order when there were saved.I would like to find out is there any better way to achieve this? can i use the timestamp column in MS SQL?
I am just doing a bit of error handling. I am just check to make sure that a user has selected an option within a combo box (named cbtitle1) and if option has not been selected throw an error message to tell the user.this if statement is within a save button which once a user click save this error checking runs first then if combo box has an option selected the save goes ahead else it throws an error.I can stop the save function OK but I wanted to put a error icon in with the message box but I get an error when I add it.[code]
Obviously error handling is a major factor in making a good application. If a error happens letting a user know what has gone wrong.But some times error handling may(i think) not be needed. Example.
Private Sub RemoveCheckedl() Try For Each Item As ListViewItem In lst.CheckedItems[code]....
also when error handling it's could to think about what type of errors could be made.
Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
even though this catches the error and displays a msg, it may not be a great message for the user so he/she can understand.
NET gurus... How would you convert this very chunk into VB?
[Code]...
When I use an online converter (Telerik), the middle line converts like this: Me.timer.Elapsed += New System.Timers.ElapsedEventHandler(ManageThreads) with 2 errors:
1- "Public eventElapsed is an event and cannot be called directly. Use raiseEvent
2- Delegate requires an Adess Of expression. Do I simply add "Address Of" ?
I've been trying to figure out how to get this control to work for over a week. It can be found here: A Professional Calendar/Agenda View That You Will Use - CodeProject. It's a calendar/scheduler control that was designed using c# and I'm trying to use it in my vb.net app. I've sucessfully created a dll and have referenced that dll in my project and am able to see the controls in the toolbox as well as put them on my form. My problem is that I can't get ANY of the code that I wrote in the form to fire. No event handlers will work, not even the form_load which handles the mybase.load event. Nada. f a reason that this might be? How do I sucessfully add a handler to the events? I've used <code> addhandler monthView1.SelectionChanged, addressof (and nothing I put here ever works) </code>
I have a general question regarding best practices for exception handling. I have a class library that uses structured error handling. The functions in the library generally perform some mathematical calculations and all return a boolean value indicating whether an exception occured or not (i.e. exception occured = true, no exception = false). The actual calculated result in the function is returned as a ByRef parameter.
Anyway the input variables for my calculations are all passed to the funtions as parameters. I perform some basic checks on these inputs (e.g check that an input is not negative etc) as part of the function code. The next stage is where im unsure of the best way to do things. Using the example i just mentioned, if an input parameter is negative, I can either throw an exception such as "ArgumentOutofRange", or i can simply show a messagebox with some info about what happened. Either way i do it the function will return true. At the moment i am throwing an exception, but on reading the "Best practices for exception handling" it is recommended you dont throw an exception for things that can be checked programatically because of "performance/overhead issues".
I'm a little confused by what they mean by this. What kind of overhead are they talking about? Slower program? More disk space required? More memory required? When my functions return true, the calling methods basically drop everything and stop calculations (exit sub), so im not sure that the overhead issues they are talking about are as important to me. It seems easier and neater to throw an exception and utilize some global error strings and pass some parameters rather than copy and paste messagebox.show() all the time, and modify the text to suit the situation. Another argument for me would be that both methods of exception handling utilize a messagebox, which stops code execution until the user does something. So i cant see the issue with the performance overhead.
for the program I am creating I want the computer to check if the configuration file has been created or not. I wrote this function to do that but I don't how to handle a file exception. Here's my code currently but obviously it returns an error if the configuration file doesn't already exist. So how do I add a check for an exception?
Public Function CheckIfRunBefore() Dim ConfDirectory As String ConfDirectory = "" Dim StreamReader As New IO.StreamReader("C:\VRAI\Conf.txt")
Iam having major difficulties handling a binary stream which I am trying to read and process in vb.net. The stream is coming in from an FTDI chip and should contain 64 8-bit values.An example of the stream is here
I need to get this into something that I can read (decimal or hex or 1s and 0s) in vb and I just don't know what to do - I tried using Asc() but it wasn't working and I know now that it can't work with characters higher than 127.
I'm writing a simple application - address book. User enters new addresses and they are added as an entry to a list visible on the main form (frmStart). I use one form to add and edit (AddContForm). Add button on the frmStart works fine, however I experience some problems with the edit button as when I press it and enter new data they are added as new entry however the previous entry is still there. Logic is handled by Contact.vb class.
Contact.vb Public Class Contact Public Contact As String Public Title As String
[code]....
Update:I really don't care much for whether the data on the AddForm is the old data or the new data. I think the problem now is that when I click edit previous entry on the list is not deleted (what I believe I have indicated in my question) - I tried to delete it (by using the if condition and checking what button was pressed) however it seems it is not working properly for some reason.
I haven't done any programming in a while, and I have pretty much 0 experience with databases, so I'm hoping I can get some guidance with what I'm trying to achieve.I have a class (or want to have) which represents a person, for each person there's multiple dates, and for each date there's multiple events which have properties like time, place, duty, etc. I want to be able to save and load this from a database using a form. I want it to be able to function where I can type in the person's name and it will load all the data into the form, which has a combo box for the different dates and events, and when I select a different date and/or event I want the data to change correspondingly.
If someone could just give me a push in the right direction as to where I should be looking for help in achieving that I would really appreciate it. I don't have the class made to do any of that, just an idea of how it will function. I haven't worked much with classes, so I'm not sure how to approach it. Meaning I need guidance with classes and databases alike.
I have come accross many scenarios of handling datagridviewcombobox events, however none seem to fit my scenario, or I may be missing something.1. I need to capture the column index that the combobox is resident in. This is because I have a complete row of comboboxes that should set the header text to the selected value.here is the code I have so far:' I also use a list of string as datasource publicly declared
Public cs As New List(Of String) 'to insert the combo's into the grid Dim row As New DataGridViewRow cs.add("Book") cd.Add("Author")
I have code that pops up a dialog box and waits for either the OK or Cancel button to be clicked. I am trying to figure out how to get and use the repsonse from dialog box. If the user clicks OK, I want the rest of the code to execute normally (it already does this by default). If the user clicks Cancel, I want to skip the rest of the code. I was assuming OK would return TRUE and Cancel would return FALSE, but that apparently is not correct. How do I figure out whether OK or Cancel was clicked?
If Not MapCheck() = "" Then DiaError.TextBoxErr.Text = MapCheck() If Not DiaError.ShowDialog() Then 'show dialog box and evaluate output GoTo breakme 'if Cancel is clicked
I am developing a windows based application in VB 2005, the main form of the application is of fixed border style (i.e. user cannot resize the form), but in certain cases I am resizing my form through code. Intially the form has a fixed height i.e. 350 for normal height and 400 for extended height. But in this case the problem could not be solved effectively as the user can have different DPI setting e.g. 120, 144, 192 etc.The logic I implemented is to divide my form (vertically) into 3 parts