lolafuertes 145 Master Poster

If it works do not change it, always says my teacher. ;)

Maybe I can suggest another way to get that, but only for discussion. This has not been tested:

Public Class Form1
'
' Do you really want to have only 5 files?
' I will suggest to work with FileInfo instead, because you can have more control on what is happening with the file
'
'    Dim strFile() As FileInfo  ' But really we need no array
    Const strPath As String = "C:\Definition Data" ' declaring as a constant will not waste time nor memory on each new assignement

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'         strPath = "C:\Definition Data\"
'        Dim i As Integer
'        Dim strFile(5) As String
'        For i = 0 To 3
'    I will suggest to change this in a for each loop 
         For each existingFile as FileInfo in My.Computer.FileSystem.GetFiles(strPath)
'            strFileName(i) = strFile(i).Remove(0, strFile(i).LastIndexOf("\"))
'            cmbDefnTerms.Items.Add(strFileName(i))
' add it directly as object in the combo. 
' The file names will be OK as the default ToString for a FileInfo
' obtained using GetFiles is the file name, not the full path
              cmbDefnTerms.Items.Add(existingFile)
        Next
        
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbDefnTerms.SelectedIndexChanged
'         strPath = "C:\Definition Data"
        Dim FiletoShow as FileInfo = Ctype(cmbDefnTerms.SelectedItem, FileInfo) ' this will retrieve the selecte Item 
        If Filetoshow.Exists then ' you will verify that the file exists before showing it
            try
                 txtDefinition.Text = …
lolafuertes 145 Master Poster

In order to do that you have several approaches:

1) when the user finishes to input the miles, you can launch an event to indicate the number of miles driven, to be catch by the vehicle.

2) if the input form is launched from the vehicle using a showdialog(), then the input can have a public property milesdriven that can be read from the vehicle just after the showdialog. This property can return the textbox input value.

Hope this helps

lolafuertes 145 Master Poster

If the relation is defined to have cascade triggers on update and/or deletion, then the user must have permissions to update and/or delete in all the child related tables. If the cascade has multiple levels this applies to each level of the cascade trigger.
See this article

There is another appoach using stored procedures ownerchip chaining to circumvent this situation. See this other article with examples on how to.

Hope this helps

lolafuertes 145 Master Poster

Basically the update will have the form of

UPDATE table SET field = vlaue WHERE update_condition;

If you need to update more than one field you can

UPDATE table SET field1 = value1, field2 = value2, ... WHERE update_condition

If you are referring to the arrays of strRooms(x) to create the update condition, it will work exactly as the delete contition. You can copy-paste it.
:)

Hope this helps

lolafuertes 145 Master Poster

Every high level languages has a compiler( or interpreter) who is responsible to translate them into machine low level code.

In C#, the compiler produces executable (.exe) files, dynamic-link libraries (.dll), or code modules (.netmodule) depending the options you use.

The code modules need to be linked in order to produce assemblies.
An assembly is the basic deployment unit and maybe an exe or dll file.

You can read the Compilers: Principles, techniques and tools to help understand how they work.

lolafuertes 145 Master Poster

If any conversion shoult take pleace, always is recommended to use a try/catch structure to catch any exception and be able to process as expected.

Most of the problems with number conversions came of not testing, with some regex, that the input value is a valid number.

Also, many times is needed to convert the number format from local culture to invariant culture, using the System.Globalization, in order to process smoothly.

Hope this helps

lolafuertes 145 Master Poster

This namespace is available throug the Data Designer Extensibility (DDEX) SDK (part of the Visual Studio Industry Partner [VSIP] installation). Then it appears as reference to add to your project.

For info on how to obtain it you can navigate here

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

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

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

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

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

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

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

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

@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

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

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

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.

lolafuertes 145 Master Poster

Did you tryed some thing like this

Maybe you can explore this way.

Hope this helps

lolafuertes 145 Master Poster

I the link I send you, to create the session calls to Lotus.NotesSession, not Notes.NotesSession.

Please, verify in your registry the one defined.

Hope this helps

lolafuertes 145 Master Poster

If the new object to set, is structurally distinct of the previous one, set the property grid to a new one(oldpropertygrid = new PropertyGrid;), then set the selected object.

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

The difference, in the tests i did, is that the ConfigurationSettings.AppSettings is always returning an empty array (??), so it is currently compiling without error, but not working to me (VS2010 .NET 4.0).

Hope this helps.

lolafuertes 145 Master Poster

You are using an obsolete deprecated method to retrieve the application settings.
I would prefer to use

SqlConnection con = new SqlConnection(System.Properties.Settings.Default.radicalGuard);

Hope this helps

AngelicOne commented: thanks +1
lolafuertes 145 Master Poster

Did you already visited this site?

lolafuertes 145 Master Poster

but I'm having truble setting the value of the private variable with the values returned but a single SqlDataReader:

Can you be so kind to clarify?

lolafuertes 145 Master Poster

I am glad to help.

I this solved your problem, please be so kind to mark this thread as solved.
Thanks in advance.

lolafuertes 145 Master Poster

Instead of selected index, you need to use the selected item, and in the from clause of the select statement, you should remove the apostrophes.

Ie:

var tableName = comboBox1.SelectedItem as string;
string str1 = "select * from " + tablename;

and in the ad.Fill(ds1) the can try

ad.Fill(ds1, tableName)

Hope this helps

lolafuertes 145 Master Poster

I would appreciate if you mark the thread as solved.

TIA

lolafuertes 145 Master Poster

So, please be so kind to put your solution, and mark this thread as solved.

Thanks in advance

lolafuertes 145 Master Poster

@izyrider: agreed with you.

lolafuertes 145 Master Poster

and your question is how to reduce the number of parameters of your stored procedure?

A possible approach may be splitting the update in several steps all under the same transaction.
Another approach is not to use a stored procedure, intead use and adhoc query from your application.

Hope this helps

lolafuertes 145 Master Poster

Remove te offending cotrol from the Panel.Controls collection, or fully clear the panel.Controls before adding the new user control.

Hope this helps

lolafuertes 145 Master Poster

Cam you post the Db structure and the profile form as far you have defined them?

TIA

lolafuertes 145 Master Poster

IMO, before ad.Fill(ds3, "sccl_et"); you need to empty the table with ds3.Tabres[0].Clear; Hope this helps

lolafuertes 145 Master Poster

Your data adapter Insert, Update and Delete commands had not been defined or are written wrong way.

Please, can you be so kind to show us you data adapter definition and commands? Also show how you use them, if this is possible.

TIA

lolafuertes 145 Master Poster

When the user click on the button to search you must:
1) Open a connection to the database, if not already open. (you already written some piece of code on that)
2) Create a SELECT command to search the free dates. That will depend on your database design, if you already have one.
3) fill a datatable with the answers from the slect command usind a data adapter
4) bind the datatable to a grid or list view to show the results.

Hope this helps