lolafuertes 145 Master Poster

Maybe this article can help to understand the differences between process (or application) virtual machine, system virtual machine and host virtual machine.

Probably in your local machine the cobol process runs in the same process/host virtual machine than the form while in your system virtual machine is running in distinct process/host virtual machines just because the virtualization. This can be the reason to fail to set the parnet handle.

There are various cobol languange builders/versions but most of them are using a proces virtual machine to interact whith the OS.

Hope this helps.

lolafuertes 145 Master Poster

Please read this link for how to move a file.

To do that, you need to have the rights to acces the server. Please read this.

Hope this helkps

lolafuertes 145 Master Poster

I am not sure what the check is doing, but, IMO, you need to define the program a a single insatance running, and check at the beginning if another instance is running then shutdown the current one.

I would suggest this article for that purpose.

Hope this helps

lolafuertes 145 Master Poster

Just my cent.

Additional to the excelent info from ddanbe, here after a couple of links:
Windows forms coordinates on MSDN (here)
Coordinates systems on Wikipedia (here)

Only to say that the values to define a drawing point in a screen are always in positive values referred to the top-most/left-most corner of the screen. As X axis increases, the point is moved to the right and as Y increases, the point is moved down.

Hope this helps

lolafuertes 145 Master Poster

You already know that the unistall option is not officially supported by MS.

Did you really want to uninstall W8 or just always start W7 instead? This second option is simple: In the Control panel of W8 -> System -> Start -> change the default boot option to W7.

To uninstall W8 and leave W7 as the unique OS in the machine, this is a very good link but is not guaranteed that always will work.

Hope this helps

lolafuertes 145 Master Poster

Please, post your code for creating the text boxes array in VB and we will try to help you with some thing equivalent in C#

lolafuertes 145 Master Poster

And if you are using a windows OS, then the console command FC will do it, and also you ca redirect the output to a file using the standar output redirector.

lolafuertes 145 Master Poster

See this thread

lolafuertes 145 Master Poster

And yes, as said by @priteas, you will need the permissions to alter the database to use the sentence

SET IDENTITY_INSERT ....
lolafuertes 145 Master Poster

The SQL SET IDENTITY_INSERT must refer to a table, but in your code it refers to a column in the table. (see here)

In your example, the sentence would be:

SET IDENTITY_INSERT LOCATIONS_SETUP ON

Just to comment that, in general, is not a good idea to insert specific values in an identity column.
If you want to do that, first you need to verify that the value to insert in the table does not already exists.

Assuming that the identity colum in your example is LoacationId, you should rewrite your sentence like:

IF NOT EXISTS (SELECT LocationId FROM LOCATIONS_SETUP WHERE LocationId=10) INSERT INTO LOCATIONS_SETUP(LocationID, LocationNumber, LocationName, LocationAddress1, LocationAddress2, LocationAddress3, LocationCity, LocationState, LocationZipCode, LocationZipCodeExt, PhoneNumber, FaxNumber, BillToAnswer, BillToLocation)
VALUES(10, 1, 'Traditions in Tile / Buford RDC', '4325 Hamilton Mill Rd', '', '', 'Buford', 'GA', '30518', '', '(770) 831-5324', '(770) 831-6774', 'N', 36)
ELSE ....

On the else clause you must take an action when the value to be inserted already exists, like raising a SQL error.
Once you have inserted the value you must revert the permission to insert identity values using

SET IDENTITY_INSERT LOCATIONS_SETUP OFF

Hope this helps

lolafuertes 145 Master Poster

Say I have a class that I want to use in multiple projects, what namespace do I give it?

I would just create a separate project for this class, anc createa separate assembly (.dll)

Then, on each project i'll need it, just adding a reference to the .dll is enoug to fully use it via using statement.

IE, if you create a clas called TheClassToShare inside a project called Wdrago, your default namespace for this class will be Wdrago.

On the project referencing your .dll, you can use your class writing something like

var a = new Wdrago.TheClassToShare();

Hope this helps

lolafuertes 145 Master Poster

The hypen is usually understood as a minus sign, so the parser tries to calculate INV minus PART minus NUMBER !!!

The solution is to surround the field names between [ ] Ex:

"SELECT [INV-PART-NUMBER], [INV-DESCRIPTION] FROM INVENTORY where [INV-PART-NUMBER] like " & search1

Hope this helps

lolafuertes 145 Master Poster

Probably you have seen that there are some applications that are able to 'undo' the last action. There is no magic behind.

The programmer of those applications had to define how and what an undo button does, like any other button.

Now, on your application, you just need to write the code to be executed when the undo button is pressed.

The info by @tinstaafl is an example of a handler to determine which button has been pressed, but you need to add the necessary code to undo the action.

Using your example,

"UPDATE fieldname='" & variablename & "' FROM database.tabename WHERE date='" & storeddate & "';"

in order to undo this action, you need to do one (or many) UPDATE sentence to restore the values before you did the UPDATE.

How you can handle that?

Before doing your "UPDATE fieldname='" & variablename & "' FROM database.tabename WHERE date='" & storeddate & "';" you will need to create a command like

"SELECT TOP 100 PERCENT * FROMdatabase.tabenameWHEREdate='" & storeddate & "';"
Whith this command, yu'll need to create a data adapter to retrieve the info from the DB and fill a new Dataset (using the data adapter) with a table having the result of this select. Remember that your table must contain a field that identifies each row.

This way you'll have the values before doing the update. But this is not enough.

Also you need to save this info in a file using the Dataset save …

lolafuertes 145 Master Poster

Just adding a little bit of food...

i have multiple buttons and text boxes that recieve's its corresponding button

Maybe you'll need a table (lets name persistInfo) having 2 string fields: variableName and value.
Then an structure (lets call it undoStatus) is needed to

  • Identify the order of each click
  • Identify the event cached
  • Identify the old status persisted temp file having the variables modified by the click, and their values before the click has been done.

With this structure, you 'should' declare an static List<undoStatus> and fill it with a new undoStatus each time you handle a click event (or whatelse event you want to catch for undo).

When you'll catch an event, you'll need to:

  • Create a new persistInfo table in a new Dataset
  • Fill it with the relevant variable names and their old values
  • Save the dataset with a unique name (IE using the DateTime.Now with a mask of yyyyMMddhhmmssffffff)
  • Get the new order for the structure: can be obtained using the Linq Max function againt the list and adding one to the obtained value, or setting a 0 value if nothing is in the list. Remember this value in a static variable.
  • Set the event info and the file name for the dataset saved.
  • Add this to the list.

To undo:

  • Get the item in the list having the highest value remembered.
  • Read the referenced file into a new dataset.
  • For each row in the table, assign the old values to …
lolafuertes 145 Master Poster

Sorry for reply a little late. This is also a generic answer...

If you have many 'click evente' to catch, in my opinión, the best solution is to create an ordered list of events catched, including info about the order of caching, the 'title' of what you cached, and the location of the persisted info.

The undo action, will allways be done from newest to older. So, you need to get the highest order value in the list and retrieve this info, get the persisted info, and act according, and remove this entry from the list.

Hope this helps.

lolafuertes 145 Master Poster

That question is really generic, so i'll try to answer in a generic way.

As you can expect, the answer is 'That depends on what the click does'

  • If the button click adds one to a counter, the undo can subtract one from the same counter. In this case, once undone, the undo option should be disabled.

  • If the button click deletes a file, then the undo must recreate the file and fill it with the original content.

In general, in order to be able to do an undo, you need to persist the current status, before doing the action by the click, in order to be able to restore it from the result, if an undo is required. When the undo is done, then you must 'destroy' the containter that holded the status, because you cannot use it to 'repeat' the undo.

You will be aware that if more tan one undo is required, then you'll need to persist the status several times, being able to know the exact order of creation.

Hope this helps

TnTinMN commented: nice description +6
adam_k commented: Agree +8
lolafuertes 145 Master Poster

When calling the class where the form is to be used, pass the form as parameter ByRef.

Hope this helps

xHellghostx commented: Thank you.. I made it work +0
lolafuertes 145 Master Poster

In my opinion, the curent behaviour is because you launch an async action (new thread) and then do not wait for completion on current.

After launching the DownloadFileAsync, you must do a

while (wc.IsBusy){ Application.Doevents();} 

to wait for completion in the current thread, then you can finish. (see this)

Hope this helps

Ketsuekiame commented: Ah yes, I missed this. Effectively the op will start the download and then it will exit. +8
Gerardo_2 commented: Excelente, gracias!! +0
lolafuertes 145 Master Poster

Probably because the default is to declare the Modifier property of the controls in a form as Private. Change it to Public to access to its properties from another form.

Then to create the new form Form2 and show it, you need to pass the Form1 be reference to the Form2 like:

Dim f2 as new Form2(byref Form1)
f2.Show()       

and in the Form2, you shoud change the

Public Sub New()
    InitializeComponent()
End Sub

to

Dim F1 as Form1
Public Sub New(ByRef TheF1 as Form1)
    InitializeComponent()
    F1 = TheF1
End Sub

Then, later, on Form2 you can use:

F1.tsComboBox.Name

Hope this helps

lolafuertes 145 Master Poster

You can use some thing like this untested code:

Dim selectedValue As String = ""
If not tsComboBox.SelectedItem is Nothing then
    selectedValue = CStr(tsComboBox.SelectedItem)
End If

MsgBox("The selected value is '" & selectedValue & "'")

Hope this helps

lolafuertes 145 Master Poster

An overflow can occur when the recipient field is not larger enough for the data to be inserted.

I.E.: if the initial field in the DB is defined to be 1 carácter long but the current intial.text contains 2 characters, an overflow will occur.

Hope this helps

lolafuertes 145 Master Poster

The Audio class does not supports volumen manipulation.
See on this link for a Nuget Audio Package.

Hope this helps

lolafuertes 145 Master Poster

Maybe inserting values directly is a tricky way.
Please, read this article. I am sure it will help you.

lolafuertes 145 Master Poster

This KB may help you

lolafuertes 145 Master Poster

Your INSERT statement looks like:

Dim sql As String = "INSERT INTO [BuyNewTender] ([ProjectTenderingNO] ,[TenderingNo] ,[ProjectName] ,[Clientname] ,[PurchasePrice] ,[BuyDate] ,[TenderClosingDate] ,[DocumentDetail] ,[Notes]) VALUES() (@ProjectTenderingNO,@TenderingNo ,@ProjectName ,@Clientname ,@PurchasePrice  ,@BuyDate ,@TenderClosingDate  ,@DocumentDetail] ,@Notes)"

SQL executes this sentence by evaluating first

INSERT INTO [BuyNewTender] ([ProjectTenderingNO] ,[TenderingNo] ,[ProjectName] ,[Clientname] ,[PurchasePrice] ,[BuyDate] ,[TenderClosingDate] ,[DocumentDetail] ,[Notes]) VALUES()

wich results in an empty set of values, then evaluates the

(@ProjectTenderingNO,@TenderingNo ,@ProjectName ,@Clientname ,@PurchasePrice  ,@BuyDate ,@TenderClosingDate  ,@DocumentDetail] ,@Notes)

wich results in an evaluation of values in the memory of SQL server not needed any more and discarded.

There is no Exception because the sintax is mostly 'valid'.

I'll suggest to remove the () in the line 148. Also the ] in line 156.

Hope this helps

Reverend Jim commented: Good to see you back.. We missed you. +11
lolafuertes 145 Master Poster

You will need to have a static value that will represent the last systemuptime since you suspended the computer, not from the very first start.

Hope this helps

lolafuertes 145 Master Poster

Use a LINQ->Any having the appropiate comparasion function. For an example see here

Begginnerdev commented: Thank you for your help! +5
lolafuertes 145 Master Poster

Maybe an old style can be used here, some thing like

CmdinsertSite = New SqlCommand(String.Format( "insert into SiteStock(serialno,partno,technicianID,dispatcherID,ATMID,DateDispatched) values ({0},{1}, {2},{3},{4},'{5:yyyy-MM-dd}')", serialno, partno, cbSARtech.SelectedValue, cbSARdispatcher.SelectedValue, cbSARatm.SelectedValue, Ctype(dtpSARdispatchdate.Text,Date) ), AddConn)

If any of the values is not numeric, you must surround the {} with '. IE: if the third parameter was string then '{2}'.
I would suggest that Dates are to be presented to SQL always in universal format, so no mistake between 6/7/2012 being June 7th or or July 6th 2012.
Also if a parameter is string, you should use the string replace function to replace each single ' with two consecituve ones in the string to avoid the code injection.

Hoipe this helps

lolafuertes 145 Master Poster

In order to understand what are you doing, and be able to try to help you, please, be so kind to post your coding so far and comment it indicating where you find the problems, the expected resutls and the actual ones.

Thanks in advance

lolafuertes 145 Master Poster

Usually the joystick manufacturer will provide you with some API that will interact with the joystick driver to capture the joystick movements.

Hope this helps

lolafuertes 145 Master Poster

You need to stablish a connection to the access database. Then you must create a command to select the relevant recortds from the table you want.

You will need a datatable where, using a table adapter (from the commend created), you'll fill with the data.

Then you can use the datatable as data source for the listview.

Hope this helps

lolafuertes 145 Master Poster

In order to search by name, the text in the txtName must mach some entry in the DVD table in SQL.

If you defined the Name field in the SQL to be char or nchar, the legth is significant, because the content is filled with blancs in the db, so comparing without blancs can fail.

If you defined the field Name to be a BLOB (text, image, etc), is not serchable

If you defined the field to be char, varchar, nchar or nvarchar, the compare occurs as defined in the comparation method of the db: Binary, dictionary, case sensitive or not, etc, and for the nchar and nvarchar the compare is based on unicode while for the others is based on ascii. Also the base language for the SQL table plays in this scenario.

On the other question, you can add an option group with both possibilities: Search by ID, Serach by Name. Then, when constructing the select you can adjust the where clause accorging to the selection made asking if the option is checked.

Hope this helps

lolafuertes 145 Master Poster

Can you be so kind to put here the code failing? Is difficult to find error with only the message: some thing is not workinf fine. The error message you post says nothing to any developer.

Trying to help:
Did you checked the regional settings and language are all the same in both machines?
Did you provided mechanisms to convert numbers and dates to the invariant culture before accessing the database?

Hope this helps

lolafuertes 145 Master Poster

@jgat2011: Having an auto increment field as primary key is not always a good idea. Ex: assume a table for the states. If you define PK SatateId as integer autoincrement, and a field stateName as a string, you can insert the same stateName in the table without error.

Continuing from the Reverend Jim, maybe need to use SQL sentences like:
IF NOT EXISTS (SELECT Staff_Id FROM Staff) INSERT INTO Staff (Staff_Id,Staff_Name, Staff_IC,Staff_Ext,Staff_HP,Staff_Email,Staff_Position) VALUES ('" + txtId.Text + "','" + txtName.Text + "','" + txtIC.Text + "','" + txtExt.Text + "','" + txtHP.Text + "','" + txtEmail.Text + "','" + txtPosition.Text + "') ELSE UPDATE Staff SET Staff_Name = '" + txtName.Text + "', Staff_IC = '" + txtIC.Text + "', Staff_Ext = '" + txtExt.Text + "', Staff_HP = '" + txtHP.Text + "', Staff_Email = '" + txtEmail.Text + "', Staff_Position = '" + txtPosition.Text + "' WHERE Staff_id = '" + txtId.Text + "';"
where, in first place, searches for the id if exists, then if not exists inserts, but if already exists updates.

Hope this helps

Reverend Jim commented: Excellent point but watch out for SQL injection. +9
lolafuertes 145 Master Poster

I will comment a few points:
1) You need to validate that the userMsg is a valid number between 3 (because is the minimal value acceptable for 3 random integers starting at 1) and the Integer.MaxValue. If it is not, you must launch a message and exit the sub.
2) The second parameter of the function Next of the GenerateRandom random generator, is the max value to generate, so here you must pass the integer value represented in the userMsg.
3) Before starting the generation of random numbers, you need to create a integer loopCounter initialized to 0, to count the loops.
4) Assign the value of 0 to the Random1, Random2 and Random3 before starting the random number generation.
5) To verify the rightness of the returned values, you must also verify that the Random1 is not equals to the Random2.
6) You must assign your returned values to some label to be shown. If you assign an Integer to a Text, VB automatically uses the default method ToString to convert the integer to string.

You can just change the code to some thing like this untested code:

Dim userMsg As String = InputBox("Please Enter A Number?", "Integer", "Enter your integer here", 500, 700)
Dim GenerateRandom As New Random(DateTime.Now.Millisecond)
Dim Random1 as Integer = 0
Dim Random2 as Integer = 0
Dim Random3 as Integer = 0
Dim loopCount as Integer = 0
Try
    Dim m as Integer = CInt(userMsg)
    If …
lolafuertes 145 Master Poster

The rror code returned should be 0 or non 0? In the first piece of code you ask for non 0 (line 40), while in the second you ask for 0 (line 38).

Also on the first piece of code you miss to call the SysytemParametersInfo.

Hope this helps

lolafuertes 145 Master Poster

On your first post, I understood to ahow every five seconds to show a row.
On your last one, are you saying every 30 the hole database info?

Please elaborate

What is unclear for you?

I think I described, every sentence and the exact place to put each, all what you need to do modify the piece of code you wrote here.

Please le us know

lolafuertes 145 Master Poster

Glad to know.
Then, please be so kind to mark the thread as solved.
Thanks in advance.

lolafuertes 145 Master Poster

Before you start reading data you'll need a timer

Dim WithWEvents ReaderTimer as Timer = new Timer

In order to define a withevents timer, you must do so on the class level.

Then, in this sub, initialize it to 5 seconds interval.

ReaderTimer.Interval=5000 ' In thousands of seconds

And Start the timer

ReaderTimer.Start

Also, you'll need a interval read permission like

Dim CanRead as Boolean = Flase

to be defined in this sub.

Then, before the Loop sentence you should add

Do
    Application.Doevents()
Loop Until CanRead
CanRead = False

This will put the application in a wait state until the timer is fired.
Before the myData.Close() you should stop the timer with

ReaderTimer.Stop()

In order to catch the Tick event from the ReaderTimer you should create a new sub

Sub RederTimer_Tic(myObject As Object, _
      ByVal myEventArgs As EventArgs) Handles ReaderTimer.Tick
    CanRead = True
End Sub

None of this code has been tested, but I hope this helps

lolafuertes 145 Master Poster

Can you be so kind to post what you coded so far?

lolafuertes 145 Master Poster

Do you have a backup of your machine?

Wich OS, version and patch level are you using?

In the control panel folder options, did you checked all the show options and unchecked the hide ones?

Did you searched for Protect in all the machine?

Let us know

lolafuertes 145 Master Poster

A 2 dimension array means that all the items, in both dimensions, must be of the same type. If the columns in the datatable are not of the same type, this can not be implemented.

While the solution from Oxiegen uses ArrayLists, and is a very good solution for unknown types of items, the solution from ChrisPadgham uses less overhead but needs to know in advance the types and the number of elements.

Also there is an intermediate solution: use a undefined length 2 dimensions array of a known type, then enlarge the array as needed.

To define the array (lets say of integers) you can use:

Dim TwoDimensionsArray(,) as Intgeger

Then on the loop to fill the array from the datatable you can write something like:

Dim R as Integer = -1
For Each row As DataRow In <datatable>.Rows
    R += 1;
    If TwoDimensionsArray Is Null Then
        ReDim TwoDimensionsArray(0,1)
    Else
        ReDim Preserve TwoDimensionsArray(R,1)
    End If
    TwoDimensionsArray(R,0) = row("first column")
    TwoDimensionsArray(R,1) = row("second column")
Next

The ReDim Preserve sentence copies the current content in a new memory address and allocates as many space as requested. Depending on the size, this solution can have more (or less) overhead than the one of ArrayLists depending on the number of elements. Allways will have more overhead than the solution of knowing the right size.

Hope this helps

lolafuertes 145 Master Poster

Thanks for the info.
I assume you can close this threat.

lolafuertes 145 Master Poster

I've seen this behaviour if almost one of the registry files has gone over a "defective" track in the disk, or, if you have a RAID disk (2, 5, or whatelse) one of the disk is failing an gets a lot of time to sync with the other(s).

I would suggest to do a full backup into an external disc, and then, run a CHKDSK with the /B switch (that will reevaluate the disk for bad clusters, bad sectors (and recover any readable info), and fix any common error in files or directories)

If any bad sector or cluster is found, you should replace the disk a.s.a.p.

Hope this helps

lolafuertes 145 Master Poster

Please, be so kind to mark the thread as solved. :)

Begginnerdev commented: Marked as solved, sorry for the delay. +2
lolafuertes 145 Master Poster

The most common situation is assumming that the field is a string field, but is not.

Please, verify in the DB definition the field type, and use the apropiate get.
If you are unsure, using the GetValue(shtCntr).ToString (instead of Getstring(chtCntr))will try to get the field value, and then convert it to string.

Hope this helps

Begginnerdev commented: Thank you! +1
lolafuertes 145 Master Poster

You need to read each row in the table, then decrypt the password field.

You can do it by using a data adapter to fill a datatable, then using a foreach loop analyze each row in the datatable, decrypt the password and update the datatable row.

Finally, use the datatable as datasource for your datagrid.

Hope this helps

lolafuertes 145 Master Poster

I will suggest to do the following to read the line:

if (sr.Peek() > -1) 
   {
       lblhighscore.Text = sr.ReadLine();
   }

This will test if there is some thing to read before launhing the read line function.

Hope this helps

lolafuertes 145 Master Poster

ciphertext = Encrypt(txtEmailPass.Text)

Wich encrypt function are you using? Is written by your self? or is some of the predefined System.Security.Cryptography? Which one?

Did you already read this?

Let us know

lolafuertes 145 Master Poster

Find info here

Usually this is located under %WINDIR%\System32 folder. If found elsewhere, then probably is a virus.

I'll suggest to run a full disc scan booting from a clean OS.

Hope this helps