lolafuertes 145 Master Poster

Maybe you can do the following on the form designer:
1)Set the datagrid properties in order to select all the row at opnce, and to multi row select = false in order to have only one selected row.
2)Add the event handler for the SelectedIndexChanged event in order to be able to calculate the total hours worked.

On the source for the SelectedIndexChanged event handler you can
1) Get the selected row into selectedRow
2) get the date from this row into selectedDate
3) define an integer totalHours with a value of 0
3) for each currentRow in the datagrid.Rows
3.1) if the date of the currentRow is equals to the selectedDate then
3.1.1) add the officeHours value to the totalHours
4) lets your label equals to totalHours to string

Hope this helps

lolafuertes 145 Master Poster
lolafuertes 145 Master Poster

Did you opened it whith the Visual Studio Resources Editor?

Even you can open it with the Notepad or XMLNotepad.

Hope this helps

lolafuertes 145 Master Poster

Even references a C# solution, have you read this?

Hope this helps

lolafuertes 145 Master Poster

That is fine.

Just I am guessing that when you reference the functions in the query, you do not specify that they came from a form(Ie: MyForm.GetCustomer()).

If I remember well, the form functions are not in memory if the form is not opened, so are not allways accessible.

To avoid this situation, the 'best' solution is to place these functions in a new Module ( not form depending) and always being defined as public. Also, you'll need to move all the private fields referenced by them to public fields in the module. My suggestion is to pass all the set and al the get functions.

Then you best change the where clause to be like

(IIF(IssNull(GetCustomer()), True, (tblRMA.Customer)=GetCustomer()) AND IIF(IsNull(Getmanufacturer(), True, (tblModel.Manufacturer)=GetManufacturer()) AND ((tblModel.Type)=GetType()))

This way, in case of null answers will not filter by this column (least bad option).

Hope this helps.

lolafuertes 145 Master Poster

Please, be so kind to confirm that a dataset deinition exists on your project and the 'database' is created from it.

If my assumption is OK, then you should have also table definitions for table Users as 'UsersDataTable? and definitions for 'UsersRow'.

If all this is ok, then changing the line 1 as proposed by jugosoft will be enough.

Hope this helps.

lolafuertes 145 Master Poster

Visit this site
Hope this helps

lolafuertes 145 Master Poster

Be aware that lines 13 to 15 can fail if no selected item in combobox.

Be aware that the selected item in combobox does not 'disapears' if you change the combo box from enabled to disabled.

So I would sugges you to change your code to some thing like:

.
  .
  .
  Dim query As String = ""
  Dim name As String
  Dim id As String
  Dim room As Integer
  room = ComboBox2.SelectedItem
  name = ComboBox3.SelectedItem

  If RadioButton1.Checked Then
       If ComboBox1.SelectedIndex >= 0 Then
            query = "select * from Member where Id=" & ComboBox1.SelectedItem
       End IF
  ElseIf RadioButton2.Checked then
       If ComboBox2.SelectedIndex >= 0 Then
            query = "select * from Member where RoomNo='" & ComboBox2.SelectedItem & "'"
       End if
  ElseIf RadioButton3.Checked then
       If ComboBox3.SelectecIndex >=0 Then
            query = "select * from Member where MemberName='" & ComboBox3.selectedItem & "'"
  End If

  If query.Length > 0 then
  '
  ' Update here
  '
  End if

  .
  .
  .

Additionally, on the RadioButton CheckedChanged event, reset the corresponding ComboBox SelectedIndex to -1 (no selection)

Hope this helps

lolafuertes 145 Master Poster

Change lines 15 and 41 to

dataGridView1 = new DataGridView();

Hope this helps

lolafuertes 145 Master Poster
lolafuertes 145 Master Poster

Can you be so kind to put here the SQL text of your query?

lolafuertes 145 Master Poster

You need to use pointers on c#.

As an starting point you can read http://www.c-sharpcorner.com/UploadFile/pcurnow/usingpointers10022007082330AM/usingpointers.aspx

lolafuertes 145 Master Poster

The question is that you are retrieving the member info from the group, not the user it self.

Using the member info, you need to get a new directory entry corresponding to the member info returned.

If the new directory entry is of type user, you'll have all the user related info. The parameter 'SAMAccountName' will return an array of values with one item (0) having the NT account (or can be empty).

Be aware that the resulting directory entry also can be a group (nested), or machine (PC, Server), or printer, or mailbox, or whatelse directory object, so you must test this to skip (or call recursively) this entry info.

Hope this helps

lolafuertes 145 Master Poster

The sentence Tclients.AddUsersRow(a); is expecting a to be a UserRow, not a string.

In order this to work you must:
1) change the line 2 to: var a = new UserRow;
2) change the line 11 to: a.Item(0) += c.Name + ", "; // because the index is base 0 and assuming you only need one field

Hope this helps

The result should

lolafuertes 145 Master Poster

Did you visit http://msdn.microsoft.com/en-us/vsto/default ?

Those tools are included in VS2010. You can find examples on how to, for both VB and C#.

Hope this helps

lolafuertes 145 Master Poster

Try the BGInfo utility from MS (http://technet.microsoft.com/en-us/sysinternals/bb897557)

Yu can launch it from VB (i.e. Shell("BGInfo.exe")). See the possible parameters and configurations to obtain the right result.

Hope this helps

lolafuertes 145 Master Poster

The question here is that every time you launch the button click event, you fire a loop, always ending at 5.

Istead you can
1) declare the counter outside the button click procedure
2) monitor their value to start at 1 showing the button when the forms Load, and hidding the button when his value is greater than 5 after incrementing it in the button click procedure.
3)Finally, remove the For and the Next sentences.

Hope this helps.

lolafuertes 145 Master Poster

Setting the radiobutton checked property will do the work

rbmale.Checked = (empsex = "M")
rbfemale.Checked = (empsex = "F")

Hope this helps

lolafuertes 145 Master Poster

There are almost two ways to get what you want:
1) Do a SELECT * against the table to update (using a 'WHERE 1=2' select clause in order to fill the table with no records) to obtain all the existing fileds, and use it in a data adapter to fill a dataset table. The fields collection of the datatable will give you the names of existing fileds, so you can dinamicaly create the alter sentence adding only those not existing in the table.
2) Split the sentence to be one for each field. Execute one by one and ignore the errors.

Hope this helps

lolafuertes 145 Master Poster

I will prefer to have this info in a dataset having 2 fields ( and Keys if needed)
.
Tha dataset can be persisted (saved) and loaded from disk when needed.

Also, you can update (add, remove, modify) the records easely using the XMLNotepad (from Microsoft).

Using a datasetview can help to find the answer, or you can cile over the records to show in a list view; also you can set the dataset as source for it, for a listbox or for a combobox, etc.

Hope this helps
------------------------------------------------------------------------------------------------------------------------------
If found this post helpful press the UP arrow of the post to Increase Feedback.

lolafuertes 145 Master Poster

Maybe you'll need, first, change the database in order the EmpId will be an Integer instead of string. Then create an SQL Sentence like "SELECT CASE WHEN NOT EXISTS( SELECT EmpId FROM Employee WHERE EmpId = " + txtEmpId.Text + ") THEN " + txtEmpId.Text + " ELSE MAX(EmpId)+1 END As EmpId FROM Employee;" that, hopefully, can solve the problem.

The query result will always give the right value for you

Lets explain a little what this SQL sentence does: NOT EXISTS( SELECT EmpId FROM Employee WHERE Empid = '" & txtEmpId.text & ") veryfies in the table Employee if there is any record with the searched value (txtEmpId.text), returning a true (if not) , or false (if yes), condition.

Then the SELECT CASE WHEN 'True' THEN TruePart ELSE FalsePart does the tric.

The true part (means not exists) returns the searched value.
The false part (means already exists) will get the greatest code existing (MAX(EmpId)) and add one to it to return the next empty value.

Then, using a datareader (lets call it dr as in the previous examples), you will always get one record, and the

dr.Read();
var NewEmpId = dr.GetInt32(0);
dr.Close;

will give you the answer.

If you need to present the message about found or not, then show it using an structure like

If (Ctype(txtEmpId.Text, Int) == NewEmpId)
{
' Not Found
}
Else
{
' Found
}

This approach lets the database do the work for …

lolafuertes 145 Master Poster

Normally, when an excel file is open, a file starting with ~$ and the name of he workbook exists on the same directory where the workbook exists. You can easely chek if thei file exists with a

Dim MyFile as new System.IO.FileInfo("~$Book1.xslm")
If MyFile.Exists Then
'
' Close it here
'
End If

Hope this helps

lolafuertes 145 Master Poster

Maybe you can start at http://www.youtube.com/watch?v=pRql6lZTdfg (vb net 2008 how to create a report 1)

Hope this helps.

lolafuertes 145 Master Poster

The approah to find the running processes is good to know if there is an excel instance running. Else every thing is OK.

I there is one (or more) running instance(s), The VisualBasic namespace offers the getobject method to get an instance of the running program. No matter wich one.

Once acquired, you should forcibily close any open workbook, without saving the data. (this will help the user to learn to save their work before leaving the desk)

You must then close the Excel object, and release it, and wait for a few( 5 to 10) seconds to allow the procesor to end the application, and redo the entire process until excel has no running instance(s).

Another approach maybe using old DDE techniques (MSDN search DDE and Visual Basic)

Hope this helps.

lolafuertes 145 Master Poster

Please, can you be so kind to post the resulting commands?

lolafuertes 145 Master Poster

On Access you must define the fields as Yes/No

Then

dsnewrow.Item("Urgent") = checkBoxUrgent.Checked
dsnewrow.Item("Option1") = radioButton1.Checked

Hope this helps

lolafuertes 145 Master Poster

Just some hints:
If you want one additional column then change to

Dim str(qtyCols) As String

Then, before creating the ListViewitem, add the calculation.

str(qtyCols) = (Microsoft.VisualBasic.Val(str(qtyCols-2))/Microsoft.VisualBasic.Val(str(qtyCols-1)) * 100).ToString

or whatelse calculation you need

Hope this helps.

lolafuertes 145 Master Poster

Two?

Lets start on point 4:
Remove the () on the line 19: serial = MaskedTextBox1.Text 'Gets the serial number

Point 3:
You only release the xlBook. You need to release also the xlSheet (before releasing the book) and the xlApp (after releasing the book). You don't need to call GC.

Point 1:
Yes you can select multiple files if you set the listbox SelectionMode property to Multiple

Point 2:
If you need to show results for multiple files, I would suggest to change the form presentation, avoiding all the individual fields and replacing them with a ListView.

Each file result can be created in a new ListViewItem and the corresponding ListViewSubItems for the field info to show. On design time you can set the column headers you need.

Hope this helps

lolafuertes 145 Master Poster

The function GetWors is expected to return one or more words, but the receptor english is a string that can only hold one, so the conversion is not possible.

Changing to

Dim english() As String

will do the work.

Hope this helps

lolafuertes 145 Master Poster

Please, verify the line 18 of your code.
Maybe you need to change to

da.DeleteCommand = myBuilder.GetDeleteCommand

Hope this helps

lolafuertes 145 Master Poster

Did you refresh the data gird source after inserting into the DB?
I can't see it in this sub.

Hope this helps

lolafuertes 145 Master Poster

Did you End your program?
I we can see your code, maybe we can better help.

lolafuertes 145 Master Poster

Maybe on line 12 of your example you can add:

Dim Parts() As String = Lines(0).Split("="c)

then show the Parts(1)
or change the line 14 to

Me.TextBox1.Text=Lines(0).SubString(Lines(0).IndexOf("="c) + 1)

The first solution can fail if no '=' sign exists.
The second solution will show all the line content is no '=' sign exists.

Hope this helps

lolafuertes 145 Master Poster

You must query to the database table to return the not entered words using a SQL sentence like

SELECT Word FROM WordsTable WHERE Word NOT IN ('word1', 'word2', ...)

lolafuertes 145 Master Poster

I would suggest to use an small utility PrimoPDF from http://www.primopdf.com/download.aspx to convert to PDF.
If you use an access database for source, you can create an Access Report to create the labels, then print them to the PrimoPDF virtual printer.

Hope this helps.

lolafuertes 145 Master Poster

You did not put your LAN card configuration here as requested. So is difficult to imagine what the problem is.

As this is a predictible time based issue, I believe that some parameters of the LAN card configuration had been reset or modiied. On the Local Area Connection roperties for the wire controller (the knowledge of model, version and driver version can help), pressing the configure button and going to the advanced tab, maybe you can find some options, like Auto Disable PHY in enabled state, or Interrupt Moderation as Enabled. Maybe the receive buffes is to high or to low, also the send buffers. Maybe you have some features enbled or disabled that helps to 'hang'.

Also on the Power Management tab, you need NOT to allow the computer to turn off the device to save power.

Hope this helps.

lolafuertes 145 Master Poster

Thanks for the reply.

Maybe you can be so kind to show use final design, and mark this thread as solved.

lolafuertes 145 Master Poster

Sorry, never heared of GemBox. I've seen on their web that you can download a limited in use trial/demo.

I just prefer to use the Microsoft standars when no special features of third party are needed, so evaluate if you need to spend money or not.

Hope this helps

lolafuertes 145 Master Poster

Just some comments.

Your Billing and Findings Tables must have a field with ConsultNo to link with the Consultation table. Change the relation according.

Probably you need to connect Medication to the Doctor and to the Pharmacy so you'll need the fileds for DoctorId and PharId in the Medications table and change the relations according.

On the Appointment table you'll refer also to the Nurse and to the Patient related to this appointment, so add the NurseId and PatId fileds to the appointment table and change the relations.

Probably you will add a relation between Lab_results and MedTech. Also you will need tohave the result values, and alslo the reference min/max values and the unit of mesure for the Lab_Results.

On the confinement table maybe you will know the patient, adding the PatId and setting the corresponding relation between Patient and Confinement.

Abut the OutPatient relation to the Patient defined 1 to 1 means that you never can creat a new patient, because you need an existing outpatient with the same ID, but you alse never can create an outpatiente because you need an existimg patient with the same Id. to solve this, you can add a OutPatient flag in the Patient table and forgot about the OutPatient table.

Hope this helps

lolafuertes 145 Master Poster

Do not bind the datagridview to the datatable.
Instead, after each query to the DB, manully add a new row to the datagridview with the info from your data table.

Hope this helps

lolafuertes 145 Master Poster

A suggestion is to convert your array to a datatable, then set the datatable as the data source of the data grid view.

Hope this helps

lolafuertes 145 Master Poster

Lets assume that the UnsortedArray contains the following: {"1,2","3,4"} This will means 2 elements, so the UnsortedArray.Length is 2.

Then the Join(UnsortedArray, ",") Returns "1,2,3,4," and the .Split(",").Length (CommaCount) is of 4.

When you calculate the starting position to copy by means of Var = CommaCount - UnsortedArray.Length + 1 that in this case will be 4 - 2 + 1 = 3

Unfortunatelly in this case, you are trying to start copying past the end of the UnsortedArray resulting in an exception.

If the original value of the UnsortedArray was {"1","2") Joining and splitting will result in a CommaCount of 2. Then Var will have a value of 1. Until here there is no problem.

In this case the problem arises when the elements to copy is greater than one, because you run out of the source once more and got the exception.

Said that, take care to have a destination UnsortedNumArray large enough to hold the number of elements to copy over it. In your example, you start to copy over the second element (1) with Length so the destination must be of Length + 2 elements wide at least, or you will get another exception.

Hope this helps.

lolafuertes 145 Master Poster

Do you added a System.Windows.Forms.Application.Doevents() after each action (open, close, read a cell, etc...)?

This will help the timer not to stop.

About the problem with the audio, did you tryed PlaySound API to play the sound asynchronous?

<Flags()> Public Enum PlaySoundFlags As Integer
        SND_SYNC = &H0 ' play synchronously (default) 
        SND_ASYNC = &H1 ' play asynchronously 
        SND_NODEFAULT = &H2 ' silence (!default) if sound not found 
        SND_MEMORY = &H4 ' pszSound points to a memory file 
        SND_LOOP = &H8 ' loop the sound until next sndPlaySound 
        SND_NOSTOP = &H10 ' don't stop any currently playing sound 
        SND_NOWAIT = &H2000 ' don't wait if the driver is busy 
        SND_ALIAS = &H10000 ' name is a registry alias 
        SND_ALIAS_ID = &H110000 ' alias is a predefined ID 
        SND_FILENAME = &H20000 ' name is file name 
        SND_RESOURCE = &H40004 ' name is resource name or atom 
    End Enum
    Private Declare Auto Function PlaySound Lib "winmm.dll" Alias "PlaySound" (ByVal lpszSoundName As _
String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
    Public Sub PlayWavFile(ByVal WaveFileName As String)
        Try
		PlaySound(WaveFileName, 0, PlaySoundFlags.SND_FILENAME Or PlaySoundFlags.SND_ASYNC)
        Catch ex As Exception
        End Try
    End Sub

Hope this helps

lolafuertes 145 Master Poster

If the database is an access database, then you need to have permissions to the folder.

lolafuertes 145 Master Poster

The usage of Var in your array copy, is trying to obtain the lowerbound value of the dimension Var (in your example always greater than 0), while there is only one dimension (0) on the array.

If you want to start copying from a certain point, use it as starting index, also copying 0 elements does nothing. you can try some thing like:

Array.Copy(UnsortedArray, Var, UnsortedNumArray, 0, ElementsToCopy)

Hope this helps.

lolafuertes 145 Master Poster

This is because the focus still on the button.

On the button click event, you can set the focus to another control to 'remove' the rectangle

Hope this helps.

lolafuertes 145 Master Poster

Never used gembox.

In order to read the information from the excel workbook, is enough to add the Microsoft.Office.Interop.Excel .NET component (12.0.0.0 for Excel 2007) reference to your poject. You do not need third party programs for that.

Assumming you know the name of the file, an you have a DataGridView, heeafter a function that opens the file and loads into the datagrid

Private Function OpenExcel(ByVal ExcelFileName As String, ByRef Dg As DataGridView) As Boolean
		'Declare the return value: true if loaded OK else false
		Dim ReturnValue As Boolean = False
		' Define the excel application
		Dim ExcelApp As Microsoft.Office.Interop.Excel.Application = Nothing
		' Define the Workbook
		Dim Wb As Microsoft.Office.Interop.Excel.Workbook = Nothing
		' Define the workseet
		Dim Ws As Microsoft.Office.Interop.Excel.Worksheet = Nothing
		'
		' Verify if the file name exists
		'
		Dim Fi As New IO.FileInfo(ExcelFileName)
		If Not Fi.Exists Then
			GoTo Exitfunction
		End If
		'
		'	instantiate the excel application
		'
		Try
			ExcelApp = New Microsoft.Office.Interop.Excel.Application
		Catch ex As Exception
			MsgBox("Unable to load Excel 2007", MsgBoxStyle.Critical)
			GoTo Exitfunction
		End Try
		Application.DoEvents()
		'
		' Open the workbook from the supllied file name
		'
		Try
			Wb = ExcelApp.Workbooks.Open(ExcelFileName)
		Catch ex As Exception
			MsgBox("Unable to open '" & ExcelFileName & "': " & ex.Message)
			GoTo Exitfunction
		End Try
		Application.DoEvents()
		'
		' Verify if this is a valid excel file
		'
		If Wb.Sheets.Count = 0 Then
			MsgBox("'" & ExcelFileName & "' is not a valid workbook for Excel 2007", MsgBoxStyle.Critical)
			GoTo Exitfunction
		End If
		Application.DoEvents()
		'
		' Get the …
lolafuertes 145 Master Poster

When you do any action agtainst a database, the DBMS uses to 'mark' the database being used by you. Also 'marks' the tables, and also each record you access, to be sure that, if any other user want to access to the same info, can access (or not) depending on the actions pending.
This process is called Locking. Locking is done writing in a special table the info of what is being locked.
By default, locking is done at 'page' level. Depending on the size of the each record in the table, many can be locked. If a page is locked for shared read, it can't be modified until the lock is released. If is locked for update (insert, update or delete) can't be read until the write operation is finished.
The duration of the locking depends on how much time your connection / sqlcommand needs to finish the work and to release the objects locked. Then the DBMS needs to free the locks in the DB. This also consumes resources.

Hope this helps

lolafuertes 145 Master Poster

Wire?

lolafuertes 145 Master Poster

If you put your code here, maybe we can see where the problem is.

Anyway, if you are usin a data adapter, maybe you forgot to call it for Update.
Otherwise, maybe you forgot to set the data adapter commands commands for insert, delete and update.

Hope this helps.