I need to write a long-running process with a While/End While loop.
To avoid freezing the UI, I added a BackgroundWorker object on the form.
Next, I needed to update the UI, but found that the thread cannot do this. Instead, the thread must call ReportProgress() to trigger the ProgressChanged() event.
However, I need to pass the text from the exception (ex.Message) to the event, but didn't find an example on how to do this. I need that text message to update the form's title bar.
Here's the code:
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
While (True)
Basically, I have a gridview that is opened in a new window from the parent window. It has a bunch of records with a view button to view the details of each record (which stays in the same newly opened window). I have a calendar in the parent window that accepts a Date querystring parameter to set the current date on the calendar at page load. I'm just trying to refresh the calendar in the parent window to match the date of the label in the newly opened window.
All the code below is in the newly opened window. The .Net code-behind below refers to when that view button is clicked and everything is populated. At the end, I call the js to refresh the parent window and pass the value of the LabelScheduleDate as the querystring parameter. Now the label comes through as '03/25/2010' in the code-behind, but when I pass it to the js, it comes through as '0.00005970149253731343' in the end querystring. I'm not really sure what is making the value change, and I want to pass it as just text. Do I need to pass it as a string object? I tried but I don't think I was doing it right.
JavaScript Function function RefreshParent(inputDate) { window.opener.location = window.opener.location + "?Date=" + inputDate; }
I have a statement: dat.XoaNhanVien(Me.dtgcapnhatthongtin.CurrentRow.Cells(1).Value, message) That is a function for deleting info. Now I want to create other function and get above function to parameter. I mean: Public Function func(Byval func as " What type can be ?")
I am currently still learning to use VB.Net feature. Currently I am trying to execute a .exe file where there will be passing parameters to run the script. E.g. this how it works on the command prompt line: C:Documents and Settingsproject1>textfile.exe file1.txt file2.txt file3.txt file4.txt Above line will be able to run the textfile.exe script.
I am using VB .Net to create a User Interface where user will be able to use the 'OPEN CLICK' button to choose the files (which will display on a textbox) and click on a 'START' button to run the program. I managed to find a code - process.start() feature, however it cant seem to work..
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim MyProg As String Dim executable As String executable = "C:Documents and Settingsproject1 extfile.exe" MyProg = TextBox1.Text Process.Start(x, MyProg)
I have various shape objects, and I want each unique shape to implement a saveToDB method that simply calls a DB object that implements a Save method with an object as its input paramter. This DB.Save method will be a long case function that implements the proper SQL commands based on the type of attributes possessed by the input parameter object.how do I implement the SaveToDB method in my Shape class? Is it something like this:
Function Shape.SaveToDB DB.Save(Me) End Function
The goal here is to let each shape save itself without it knowing anything about database operations; I want to isolate db-specific information in my intermediary DB object, so the DB object will have to figure out what type of object wants to be saved into the SQL database and then execute whatever SQL instructions are needed. And then if I override the SaveToDB method in each shape subclass, I can avoid the case statement entirely, replacing it with a series of unique methods such as db.SaveCircle (ob), db.SaveSquare (ob), etc., sincle the caller already knows what it is.
I am trying to load a combo box based on a selection of data from another combo box. I am not sure how I would pass the value to the object. My thought is I am loading all the table data onto my object and then I would run the query on the object. However I am at loss as to how I would go about doing that.
Private Sub cboOrder_SelectedIndexChanged(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles cboOrder.SelectedIndexChanged Dim selecteditem As String
how to use a button to pass a SQL parameter "ContactID" to the next page to allow the SQL to execute the Select Query. From what I've found here is what the code behind for the button looks like.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ContactID As String ContactID = Request.QueryString("id")
[code]....
Here is the error I'm getting back. What have I done wrong?Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
The reason why I need to do this is because I have a sequence of two lines of code that is littered all over my program, where I dynamically remove the handler to an event, then set the handler again. I'm doing this for several different events and event handlers, so I've decided to write a function that does this. [code]...
I have a mail webform where I have to show the user only (-1) one day behind messages, so how do pass (yesterday)date as parameter and retrieve the only records of one day back ?This query is for 'ALL' messages, but I need to filter (yesterday) one day back messages and add a hyperlink or add in a dropdown ?
select MSG_SRNO,MSG_SUBJECT,MSG_ID,MSG_CHKD, DOF_SENT,DOF_SEEN from MESSAGES_MAILBOX where USER=1234
i struggling to pass two parameter to an event handler basically when the page is load it dynamically create some control lable, textfield, and linkbutton when i click on the link button it fire an event handler, here is my problem i want to pass first the Product ID and quantity, the product id is fetch from the database passit thorugh an object where as the quantity it enter by the user first part of the code it connect to database loop through and display all record on the page dynamcally
I currently have a page that is populated using a filter, which passes the parameters of the filter via URL.
I'd like to catch those parameters and give the user the opportunity to return to the page with the same filter applied to their view. Essentially, it's a back button. AKA: pass the parameters back into the URL so it repopulates the page.
I'm new to VB.Net. I'm using a library call setInstance(ByVal instance As UInteger) in my VB.Net code. The parameter I need to pass is an Integer. Is there anything I need to do to convert the integer parameter to an unsigned integer? The number is garunteed to be positive and less than 10.
Can I pass a form as a parameter in a sub like public Sub GetData(Byval Frm as form) and access its controls?I have few forms (you can say: FrmAccounting, FrmEngineering, FrmIT) with almost the same controls in each of them (txtEmployeeID, txtEmployeeName, optMale, optFemale etc), where no two forms are open at same time, and each of those forms have a Button which opens a new Form (you can say FrmCollectData) now I want to fetch data in FrmCollectData depending on which form it was opened from.. like if user was on FrmEngineering and it clicks button to open FrmCollectData.. form collectData fetches data from FrmEngineering Controls and if user was on FrmAccounting and it opens FrmCollectData, form Collectdata fetches data from FrmAccounting..
earlier, in VB6.. In one of the Sub written in frmCollectData I checked which form is opened by setting flags in each of forms (frmEngineering, frmAccounting etc) and then I passed the same form in a sub which writes data in frmCollectData controls.. but am not able to do the same in VB.NET.
Just asking for personal preferences, pros,cons on the following situation. I have a class(classA) that has some shared members in it. I have a procedure in a form that needs to execute a function in a separate class(classB). This function requires some of the shared member values from classA. I can either pass these values as parameters from the form to classB, or in classB I can just access them directly by referencing classA. As a general rule I've tended to try to use parameters to pass all the information a function needs but it starts to seem a little unwieldly when passing several parameters to multiple procedures.
i am designing an application in which contents of an excel file are displayed in the ListBox. i have created a class which contains methods for doing this. Statement used for function call is:
From a button located to a new form i am trying to open another form using Manage_groups.ShowDialog() That works fine, but now I need to pass a parameter in order to read it on the new form but Manage_groups.ShowDialog(thisbutton.Text) it's giving me error Unable to cast object of type 'System.String' to type 'System.Windows.Forms.IWin32Window'.
this is my coding when i run this coding for display the content in textboxes from the database by click event in datagrid. "Procedure or Function 'sp_developer_display' expects parameter '@developerid', which was not supplied."this error will display my sp in sql express is ALTER PROCEDURE dbo.sp_developer_display(
When the user clicks on a control on my form I want to open or show another form and display some properties of the control that was clicked. I want to use the same form to display the properties of several controls, based on which one was clicked. I am not sure how to approach this, can someone point me in the right direction?
I have a SqlDataReader and need to read a varbinary(max) column from it using the SqlDataReader.GetBytes() method. This method populates a byte array and therefore needs to know what length of data to read.This is where I get confused.. Clearly I want to read all the data that has been returned from the database in this row/column so what 'length' parameter should I pass?As far as I can see, the SqlDataReader doesn't provide any methods to discover what length of data is available, therefore this method seems fairly awkward to me.I'm tempted to just pass int.MaxValue here and forget about the issue but something about this doesn't sit right with me.
I am aware that I can instead call
byte[] value = (byte[])dataReader["columnName"];
.. and this seems to completely take care of the length issue internally. However I am working with a set of complicated code generation templates that have been built around the SqlDataReader.GetXXXX() methods. So I am tied into using GetBytes and need to understand its proper usage.
I have a SqlDataReader and need to read a varbinary(max) column from it using the SqlDataReader.GetBytes() method. This method populates a byte array and therefore needs to know what length of data to read.This is where I get confused.. Clearly I want to read all the data that has been returned from the database in this row/column so what 'length' parameter should I pass?As far as I can see, the SqlDataReader doesn't provide any methods to discover what length of data is available, therefore this method seems fairly awkward to me.I'm tempted to just pass int.MaxValue here and forget about the issue but something about this doesn't sit right with me.
am doing program in vb.net 2010 with sql serevr 2008 and i would like to pass a parameter to my crystal report to print a two related table and make an invoic print.[code]
I'm currently working on being able to import a DLL written in Fortran into Visual Basic. I've got all the basics down, so now I'm trying to take it a step further. The title basically says it all, but I'll explain what it is I'm trying to do anyways.
For kicks and giggles, let's just assume I want to pass an object that has three double values in it, possibly representing a point in space in three dimensions. In my Fortran method, I want to take that object, print out the x value, then change the x value to 7.5. Here's my Fortran code that does just that.[code]...