lolafuertes 145 Master Poster

I hope you already installed the MySql .Net Connector and you see MySQL Database in the data sources for your project.

Please refer to this link showing how to do the connection

Hope this helps

lolafuertes 145 Master Poster

I would change

Dim drivePath As String = String.Concat("\\.\" & letter & ":")

to

Dim drivePath As String = String.Concat(letter & ":")

or use the CreateFileW instead with

Dim drivePath As String = String.Concat("\\?\" & letter & ":")

Hope this helps

lolafuertes 145 Master Poster

@Mitja Bonca:
Your answer does not solves the question.
Your string length is 10, while the equivalent long length is only 9.

lolafuertes 145 Master Poster

This behaviur is the default. You can change it at Control Panel, Ease of Access Center, Make the keyboard easier to use, and check the option Underline keyboard shortcuts and access keys, then click on Save button, at each computer you want to change it.

lolafuertes 145 Master Poster

Just to clarify, in your mdb, all the fields of your table are string?

Usually, the overflow message cames when you try to insert a non numeric value in a numeric field or a non date (or bad formatted date) in a date field.

TIA

lolafuertes 145 Master Poster

May be helpful to know which ODBC driver are you using? also which parameters?

lolafuertes 145 Master Poster

Every drive has a root folder know as "\".
So starting at drive letter to search and root dir (IE: "F:\") you can use this to obtain a System.IO.DirectoryInfo

var RootDir = new System.IO.DirectoryInfo("F:\\")

Just be aware that you need to specify a doube backslash in order to be interpreted a s a single one.

At this point the root dir directoy info has a very useful function EnumerateFiles that, with the second parameter SearchOption.AllDirectories will do the trick.

Hope this helps.

ChrisHunter commented: Always a great help +1
lolafuertes 145 Master Poster

Use the Environ function searching for the "SystemDrive". (see this)
Also you can use the System.Environment.SystemDirectory to get the full path (see there)

lolafuertes 145 Master Poster

Welcome back. Hope you enjoy your break.
So the point is that you are pre-processing the input at form level so when in the textbox no key goes in.
The solution in this case is in the keydown/keypress events, set the handled to false if it is not a shortcut, so will be fordwarded to the next control.

Hope this helps

lolafuertes 145 Master Poster

See string.Format and here for standar numbers formatting or here for custom formatting.

Hope this helps.

lolafuertes 145 Master Poster

Depends on the add-in, but, normally, an add-in uses the internal variables of excel to do many things as extensions to the normal behaviour of commands, so basically they work in background and in transparent mode.

This way, you can reproduce the behaviour in a recorded macro, but you can not 'see' what is doing.

IE. Assume you have an addin that, when you type a word, always capitalizes the second letter(is only an example). Because it will react to the 'textchanged' event, it will modify the word, but this action will not be recorded as a command, because it isn't.

If you need to automate some thing using the add-in, this add-in should be managed as a COM object. Then using

Set MyObj = CreateObject("MyAddin")

you should be able to manage it. Not all the add-ins can be used as COM objects.

This way, you must know the interfaces exposed as they are not shown in MyObj.
IE. IF MyObj has a method called DoIt, the 'intellisense' or help will never show it, but you can call it like

MyObj!DoIt()

The ! is used to define an action not validable at compile time but to try in run time (defered linking)

So, the conclusion is that normally the add-in actions are not recorded separately because they work automatically when launch standard commands or actions.

Hope this helps.

lolafuertes 145 Master Poster

Sorry. Do you mean that once the macro is recorded, she can't be played again?

Plase, can you be so kind to inform us which version of Excel are you using?

lolafuertes 145 Master Poster

If I understood well, you have a data grid view. This DGV has Data Source dt.

dt is a DataTable you define in your Form Load event.

You then, on the fill button, open a connection to the DB. On that connection you search for records having "Nome" equals to the input in TextBox1.text

If you find any record, then you fill the TextBox1.Text with the content of the filed "Nome", that already shoul be equal to the current content of TextBox1.Text as you used it for filtering.

Then you add a new row to the DataTable (source of the Data Grid View) and fill it with the cuirrent content of TextBox1.Text for the field "Nome" and with 1 on the field "Quantity".

Then I assume someone should modify the content of the DGV and then you want to save/modify the current content of the DGV into the database.

I am right?

lolafuertes 145 Master Poster

Just try some thing like:

With rs
.MoveFirst()
While not .EOF
.Fields("Quantity").Value = Val(.Fields("Quantity").Value) - Val(linha("Quantity"))
.Update()
.MoveNext()
End While
End With

Hope this helps

lolafuertes 145 Master Poster

Glad you found the solution. So, please be so kind to mark this thread as solved. :)

lolafuertes 145 Master Poster

If I remember well, the new can be ommitted since .NET 2.0

The usage of new was to 'create' a pointer to the method, on versions 1.0 and 1.1, wich contents was used to add or remove it from the list of pointers to be called when an event is fired.

Hope this helps

lolafuertes 145 Master Poster

If you inherit, the inherited should have the same visibility than the inheritant.

If really the only contents is the connecttodatabase, best use private to declare the kaysonsSPdetails class and then use public to declare the connecttodatabase.

To use this class, then you can use

public class DemoDvd 
{
var k = new global::kaysonsSPdetails();

private void OpenConnection()
{
k.connecttodatabase();
}

.
.

}

Hope this helps

lolafuertes 145 Master Poster

The default dim is as object, like in the example on the page I recommended to read:

Function ShowFolderList(folderspec)
   Dim fso, f, f1, s, sf
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(folderspec)
   Set sf = f.SubFolders
   For Each f1 in sf
      s = s & f1.name 
      s = s & "<BR>"
   Next
   ShowFolderList = s
End Function

Hope this helps

lolafuertes 145 Master Poster

Maybe an spelling problem. The property is SubFolders (starting uppercase see here)

:)

lolafuertes 145 Master Poster

To copy the files and folders inside _templates from \\Server\mainjobs\_templates to the new destination directory you need to iterate through the \\Server\mainjobs\_templates subfolders.

After

Set SourceRootFolder = fso.GetFolder(sfol)

you can loop by subfolder as (untested)

For Each Folder In SourceRootFolder.SubFolders
    fso.GetFolder(Folder).Copy dfol & "\" & Folder.Name
Next

Also if you need to copy the files from the root folder then (also untested)

For Each ExistingFile In SourceRootFolder.Files
    fso.GetFile(ExistingFile).Copy dfol & "\" & ExistingFile.Name
Next

Hope this helps

lolafuertes 145 Master Poster

In the meantime, to uodate a recordset you must open it like

rs.Open "SELECT * FROM MyTable", Cn, adOpenDynamic, adLockPessimistic

Then with

rs.MoveFirst

you move to the first position in the recordset. Remember to test for the BOF and EOF contitions before you move throuh the recordset.
Then, to modify the content of a record, first locate the record. You can use the MoveFirst and MoveNext to cicle over the records.
Once found, then call the rs.Edit and assign the new values to the fields changed and update the record using the rs.Update

Hope this helps

lolafuertes 145 Master Poster

I use FarPoint to do this.

There are many libraries in the Internet to do it, but Excel.

Hope this helps

lolafuertes 145 Master Poster

If you need to retrieve the largest value from the table, doing a

SELECT MAX(CategoryNumber) FROM Categories

will return the expected value, that can be read using a data reader into an (i.e.) integer

The the result from the query can then be compared with the value entered on the text box converted to (i.e.) integer.

Hope this helps

lolafuertes 145 Master Poster

Can you be so kind to explain wich method you used to fill the data grid view (or post the code)?

lolafuertes 145 Master Poster

What is the actual content of lblProductPrice.Text when the error is thrown?

lolafuertes 145 Master Poster

Before exiting the form_key functions, do you set the handled to true, false or do nothing?
Did you analize wich control has the focus to change the behaviour?

lolafuertes 145 Master Poster

On the main form you receive the new account value created locally (empty / blank).

The Account account variable should be defined in the program class with public visibility, before the login form is launched.
Then the login form mut not define a local variable intead must use the public one from the program class to assign the account name.

In the main form, you must not set the Account account as new, because it has already been defined on the program class.

Hope this helps

lolafuertes 145 Master Poster

Maybe you need to change

tempttave = tt + tt

by

tempttave = tempttave + tt

Hope this helps

lolafuertes 145 Master Poster

So, please, be so kind to mark this thread as solved.
Thanks in advance.

lolafuertes 145 Master Poster

If I understood right, the problem is that the destination folder does not exists?
Then you should use fso.CreateFolder before copying.

Anyway, instead of using fso.GetFolder(Folder).Copy .. I would prefer the fso.CopyFolder( fromFolder , toFolder, Overwrite)

Hope this helps

lolafuertes 145 Master Poster

Or you can mark it as solved anyway :)

lolafuertes 145 Master Poster

Then I'll go back to my first answer.

Lets the Form1 to be:

PropertyGrid propertyGrid1;
      public Form1()
        {
            InitializeComponent();

            propertyGrid1 = new PropertyGrid();
            propertyGrid1.Location = new Point(10, 10);
            propertyGrid1.Size = new Size(250, 400);
            this.Controls.Add(propertyGrid1);

        }

Then, where you will need to set the SelectedObject, write some code like like:

If (propertyGrid1.SelectedObject==null){
      propertyGrid1.SelectedObject = ObjectOfClassA;}
else{
      propertyGrid1 = new PropertyGrid();
      propertyGrid1.Location = new Point(10, 10);
      propertyGrid1.Size = new Size(250, 400);
      propertyGrid1.SelectedObject = ObjectOfClassA_orB_orWhatElse;}

Hope this helps

ChrisHunter commented: Has been extremely helpfull and happy to help. +1
lolafuertes 145 Master Poster

Sorry. My miss. In order to use the SUM function you will need to add to the end of the SQL sentence:

GROUP BY dbo.Trans_Head.Doc_Date, dbo.Trans_Head.Document_No, dbo.Trans_Head.Account_Type, dbo.NewAccount.Surname + '' + dbo.NewAccount.First_Name, dbo.Trans_Details.Account_Name

Hope this helps

lolafuertes 145 Master Poster

Ys, we are interested to know what is the final goal for that

lolafuertes 145 Master Poster

@dmacalm: Yes, thats what I proposed.
@rami2005: If this solved your question, please be so kind to mark this thread as solved.
If you have more questions, do not hesitate to start new threads.

lolafuertes 145 Master Poster

Use the SelectedItemChanged on the combo to cath the new selection. Then modify the Unit cost according.

Hope this helps

lolafuertes 145 Master Poster

As far a I know, the OnStart will be launched when you issue a Start of the service.

This will initialize the service and launch the main thread. You need to provide a mechanism to stop when the OnStop is launched. Normally an static boolean is enough to notify the stop order to the main thread.

The basic mechanism to permit the comunication between threads is to have some shared memory and an object to be locked by each thread before accessing those areas, then unlocked.

When you issue a custom command, this will notify the main thread what to do. So once more, you'll need a mechanism to communicate with the main thread.

Hope this helps.

lolafuertes 145 Master Poster

If all the forms and classes are in the same project, you can add

using Namespace2

in the top of the forms, and you will be able to get the expected sintaxis.

Hope this helps

lolafuertes 145 Master Poster

You must use the same structure than in the button1 on button 2 to fill also the ListBox2

ListBox1.Items.Clear()
        ListBox2.Items.Clear()
        tt = 0
        ara.Sort()
        For Each I As Integer In ara
            ListBox1.Items.Add(I)
            tt += I
            ListBox2.Items.Add(tt)
        Next

Hope this helps

lolafuertes 145 Master Poster

The most similar in SQL

SELECT dbo.Trans_Head.Doc_Date, dbo.Trans_Head.Document_No, dbo.Trans_Head.Account_Type, dbo.NewAccount.Surname + '' + dbo.NewAccount.First_Name AS Account_Holder, dbo.Trans_Details.Account_Name,SUM(ISNULL(CASE dbo.Trans_Details.Trans_type WHEN 'DR' THEN dbo.Trans_Details.Amount ELSE 0 END, 0)) Payemnt,
SUM(ISNULL(CASE dbo.Trans_Details.Trans_type WHEN 'CR' THEN dbo.Trans_Details.Amount ELSE 0 END, 0)) Receipts
FROM dbo.NewAccount INNER JOIN dbo.Trans_Details ON dbo.NewAccount.Account_no = dbo.Trans_Details.Account_No INNER JOIN
dbo.Trans_Head ON dbo.Trans_Details.Document__no = dbo.Trans_Head.Document_No INNER JOIN
dbo.Accounts ON dbo.NewAccount.Account_Type = dbo.Accounts.Account_Type

What we do is:
NVL(Value, 0) will return 0 if the value is null. We use the SQL function to do the same behaviour.
DECODE(CompareFiled, CompareValue, ReturnValueIfTrue) will return the ReturnValueIfTrue when the contents of the compare field is equals to the compare value. If they are not equal will return a NULL. We use the CASE CompareField WHEN CompareValue THEN ReturnValueIfTrue ELSE ReturnZeroValue END to obtain the value, but because in this example the ReturnValueIfTrue can be also NULL we still using the ISNULL SQL Function.

Hope this helps.

lolafuertes 145 Master Poster

See here as one starting point

There are hundreds of examples if you search UPLOAD EXCEL in this site.

Hope this helps

lolafuertes 145 Master Poster

Your first field to insert cames from a date picker, so I guess it is a date. If a date field is defined un the user table, you should put a value, between apostrophes like a text, and in the format of yyyy-MM-dd to be clearly understood by MySql like

"Insert into user values('" & _
      Format(Ctype(Me.DateTimePicker1.Text,DateTime),"yyy-MM-dd") & "','" & _
      Me.ComboBox1.Text & ",'" & _

Hope this helps

lolafuertes 145 Master Poster

The message states that the contents of ds.Tables("Patient Database").Rows(inc).Item("ID") is not a valid image.

Even if it was, an image is a large binary object, that has an special treatement to be retrieved (see here)

Is best to save in the database only the path to the image (normally will occupy less space). Then use the Image.FromFile(ds.Tables("Patient Database").Rows(inc).Item("PathToFileImage")) to get the bitmap.

Hope this helps

lolafuertes 145 Master Poster

Use

Structure X
		Public a As Integer
		Public b As String
	End Structure

Hope this helps

lolafuertes 145 Master Poster

Change the line 7 to:
dfol = "..\" & Foldername

Hope this helps

lolafuertes 145 Master Poster

Wich ones?

lolafuertes 145 Master Poster

If this question is phyton related, best put it on the Phyton forum.

lolafuertes 145 Master Poster

Using the CMD command SET (see this) to set the PATH variable (see my previous post)

This environment variable defines the paths to be searched for executables and dlls not found on the startup folder and not in the GAC as stated here

This can also be done programatically using the GetEnvironmentVariable and the SetEnvironmentVariable from the System.Environment namespace in .NET.

Also there is a way using the API as defined here

Hope this helps

lolafuertes 145 Master Poster

I don't clearly understand what you mean in ' idealy wanted the attributes to be automatucally changed depending on the selected object as attributes differ from object to object'

As far I can see what is changing is the value of each attribute, not the structure.
So I'll try to explain what to do with the values.

Once you asigned the bill to the selected object, you can catch the changes on the SelectedObjectChanged event of the property grid. To do so you must add the event handler for it.

You may also include a 'save' button in the form to retrieve the current selected object of the property grid, convert it to your Customer class and save the values some where.

Then, if needed, you can create a new customer and set the new values before assignint it to the selected object.

Assigning a new Customer without setting the values, will create an empty property grid to be filled by the user.

Hope this helps

lolafuertes 145 Master Poster

In order to send using a group name, you must 'login' to Notes with the group name.

How to do that? Depends on how your LAN administrator and the Notes adminitrator (maybe is a unique person) have defined user authentication on both systems, if the authentication is integrated in an Active Directory or not, if the group is just an email distribution group, or can be used as an account, etc. Maybe you'll need to start a distinct thread for that.

My 'cheap' advice is to send the mails with your account, specifying some where the text: 'on behalf of the teamaccount'.

Hope this helps. I think your very first post on this thread is solved. Isn't? If yes, please be so kind to mark this thread as solved. Cheers.