lolafuertes 145 Master Poster

Please, try to add

frmMain.lvTraining.Refresh()

just before the End Sub.

Hope this helps

lolafuertes 145 Master Poster

you can change this event as:

var returnList = e.Result.ToList();
dgv.ItemsSource = resultList;
txtlastrep.Text=(string) returnList[returnList.Count-1];

Hope this helps

lolafuertes 145 Master Poster

I'm glad you get the right info.

Please be so kind to mark this thread as solved.

lolafuertes 145 Master Poster

Maybe. But, please read here about the licensing required.

Sincerely

lolafuertes 145 Master Poster

OOps. Too early in the morning ( or late in the night )

Please, be so kind to mark this thread ad solved.

Thanks in advance

lolafuertes 145 Master Poster
For Each lvi as ListViewItem in me.ListView1.Items

Sorry

lolafuertes 145 Master Poster

in me.ListView1.Items :)

lolafuertes 145 Master Poster

I would suggest to uae

textBox7.Text = oreader.GetString(0)

Hope this heslps

lolafuertes 145 Master Poster

Assuming there is one record to show, the

If objDataReader.Read = 0 Then
         
End If

will read the first record returned; then

While objDataReader.Read

will try to read the second one, but only one exist so the condition is currently false and nothing filled in the listview.

I will suggest the following code

If objDataReader.HasRows() Then
    Try              
        lvwSearch.Items.Clear()
        While objDataReader.Read
            Dim lv As New ListViewItem
            With lv
               .Text = objDataReader.Item("accountNumber")                    
               .SubItems.Add(objDataReader("division"))
               .SubItems.Add(objDataReader("Assignee"))
               .SubItems.Add(objDataReader("phoneUnitModel"))
               .SubItems.Add(objDataReader("handPhoneNumber"))
            End With
            lvwSearch.Items.Add(lv)
        End While
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
    myConnection.Close()
End If

Hope this helps

lolafuertes 145 Master Poster

Please post your table design and code written in order to try to help you

lolafuertes 145 Master Poster

Is really easy to implement.

Assume you want to modify the value of a progress bar, in htis example toolStripProgressBarMain. Direcly assigning the value to the control can result in a cross threading unsafe call. To avoid this

Create a delegate like:

Delegate sub SetProgressDel(percentage as double)

And instantiate it to pint to the right procedure

Public myDelegate = new SetProgressDel(AddressOf setProgress)

Then create a sub that will do the work like:

Public sub SetProgress(percentage as double)
    '
    '   Verify if we are running on the same or distinct thread
    '
    If statusStripMain.InvokeRequired then
        '
        '  We are in a distinct thread so use the invoke instead
        '
        try
            '
            '  Invoke the external thread
            '
            toolStripProgressBarMain.Invoke(myDelegate, new object[] { percentage })
        catch ex as Exception
            msgbox "invoke failed" & ex.Message
            Exit sub
        End try
    Else
        '
        '  We are in the original thread, then
        ' Assign the value
        toolStripProgressBarMain.Value = Ctype(percentage, int)
    End If
End Sub

And in your thread safe call, instead of assign the value to the control, call the procedure.

I translated this from c# and this vb is untested, but that's the way.
Hope this helps

lolafuertes 145 Master Poster

Please try:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim myVar As String
    myVar = Strings.StrConv(TextBox1.Text, VbStrConv.ProperCase)
    TextBox1.Text = myVar
End Sub
lolafuertes 145 Master Poster

As far as I can see, the preview is returning a blank page, because the line

Dim strText As String = Me.ListView1.Text

returns an empty string, as expected because you never filled his text propery.

Probably you should need to do some thing like

Dim strText as String
For Each lvi as ListViewItem in me.ListView1
    For Each lvsi as ListViewSubItem in lvi
        strText &= lvsi.Text & ControlChars.Tab
    Next
    strText &= ControlChars.CrLf
Next

Hope this helps

lolafuertes 145 Master Poster

Can you be so kind to put here your updated code?

thanks in advance

lolafuertes 145 Master Poster

Did you tried to use only AnchorStyles.Right for those 2 labels?

BR

lolafuertes 145 Master Poster

Please post your updated code

lolafuertes 145 Master Poster

The listbox selected item is always an object.

You can use the TypeOf operator to verify if it is a FileInfo or a DirectoryInfo class object, then act according.

Hope this helps

lolafuertes 145 Master Poster

IMO you miss to pass the parameters values to the query before executing the insert.


See here for an example.

Hope this helps.

lolafuertes 145 Master Poster

Most propably is that one (or more) of the comboboxes has no SelectedItem.

By default, there is no SelectedItem on a combobox.

To verify if the combo has one, verify that the SelectedIndex value is greater than -1.

Also is a common good practice to verify that all the fields (tex boxes text, and combo boxes selected items ToString, etc.) does not contain an apostrophe before inserting them in a command.

Hope this helps.

lolafuertes 145 Master Poster

Im glad to hear that.

If this thread has been solved, please be so kind to mark it.
Thanks in advance.

lolafuertes 145 Master Poster

Yes, your father is right. But ...
This is allowed only to users with Admin rights, and givin admin rights only to use IE appears to be risky.

If you want 2 normal users to use the server to navigate with IE, you will need to buy the Terminal Server Services license and CAL and install them.

Hope this helps

lolafuertes 145 Master Poster

Sorry, maybe i need to explain my solution a little bit more...

The part "SELECT DISTINCT Month, Year, 0 as F1, 0 as F2, 0 as F3, 0 As F4 FROM Table" will assure that, for every existing month & year in the database you will always have a record with almost a value of 0. No matter wich customer is. Allways you'll have a record for a month if almost one customer has called this month.

The part "SELECT Month, Year, F1, F2, F3, F4 FROM Table WHERE customer = " & selectedcustomer.text returns all the info from your customer, but in this case, you are unsure to have all the months.

You need to sum both results, the months with 0 values (nothing altered) with the month returned according to the filter applied and yu'll obtain a record for each existing month & year. Here the UNION ALL will return a dataset with 1 or 2 rows by month depending if the custumer has made calls (2) or not (1).

Then, this intermediate result (or sub query) named T, is totalized Grouping by month & year and giving sum of each field for that month year.

If this solution is not supported by your SQL version, then you can do it using the 2 queries (orderd by month & year) then you can cicle over the very first (year & month with 0 values) and search if a record exist in the second …

lolafuertes 145 Master Poster

If you are usiong SQL Server, you can merge a query from your table obtaining an empty structure and the table filtered contents using a union all joint like

SELECT Month, Year, Sum(F1) AS Fi1, Sum(F2) AS Fi2, Sum(F3) as Fi3, Sum(F4) as Fi4 FROM (SELECT DISTINCT Month, Year, 0 as F1, 0 as F2, 0 as F3, 0 As F4 FROM YourTable UNION ALL SELECT Month, Year, F1, F2, F3, F4 FROM YourTable WHERE Customer = '1234') T GROUP BY Month, Year ORDER BY Month, Year;

Hope this helps

lolafuertes 145 Master Poster

In order to compute the length of a structure mostly you'll need to create a default (dummy) instance of it an then compute their size.

Maybe this code, from Jim Mischel, is valid for you:

public static int GetSize<T>()
{
  Type tt = typeof(T);
  int size;
  if (tt.IsValueType)
  {
    if (tt.IsGenericType)
    {
      Console.WriteLine("{0} is a generic value type", tt.Name);
      var t = default(T);
      size = Marshal.SizeOf(t);
    }
    else
    {
      Console.WriteLine("{0} is a value type", tt.Name);
      size = Marshal.SizeOf(tt);
    }
  }
  else
  {
    Console.WriteLine("{0} is a reference type", tt.Name);
    size = IntPtr.Size;
  }
  Console.WriteLine("Size = {0}", size);
  return size;
}

Then call it using int structsize = GetSize(TMProduct) The Console output is just for debugging purposes an can be easely removed :)

Hope this helps

codeorder commented: nothing personal, just .cs code in .vb forum. -3
lolafuertes 145 Master Poster

Did you change the document size after got the image?

IMO you need to setup the page size before abcpdf creates the result.

Hope this helps

lolafuertes 145 Master Poster

After you create the objGraphics object, maybe you need to fill it with som content.

An example from Jayman in dreamincode.com:

Dim bmp As New Bitmap("bitmap filename")

Dim gr As Graphics = Graphics.FromImage(bmp)

Dim p1 As New Pen(Color.Blue)

gr.DrawLine(p1, x1, y1, x2, y2)

Dim bmp As New Bitmap(width, height, gr)

bmp.Save("bitmap filename")

Hope this helps

lolafuertes 145 Master Poster

You must invert the IF in order to verify that the returned value is not null before using it like in the following code

If [B]Not[/B] reader.IsDBNull(0) Then
                txt.Text = Val(cboYear.SelectedItem) & (reader.GetValue(0) + 1)
            Else
                txt.Text = Val(cboYear.SelectedItem) & 1
            End If

I used to referene the returned fields by their position because is a little bit faster than resolving them by name.

Hope this helps

lolafuertes 145 Master Poster

Agreed with Teme64. IMO is the best solution.

But if you can not change the database design for any reson, if I remember well, in Access you can force to return 0 when not found using the immediate if function (IIF):

("Select iif(max(val(mid(cCode,5,len(cCode)))=Null, 0, max(val(mid(cCode,5,len(cCode))))) as maxV from Contact where val(left(cCode,4)) = " & Val(cboYear.SelectedItem), con)

Hope this helps

lolafuertes 145 Master Poster

One of the ways is to create a SELECT command for your database with the range in the select clause.
With this command you can create a datareader to read row-by-row from your database and using each row, add a listview item (with subitems if needed) until no more data is returned from the database, then close the reader.

The select clause can be some thing like: SELECT * FROM YourTable WHERE TheDateField BETWEEN '2011-03-10' AND '2011-03-22' ORDER BY TheDateField ASC; In VB you can create the string for the command using:

Dim strCmd as String = "SELECT * FROM YourTable WHERE TheDateField BETWEEN '" & _
        Format(DatePickerFrom.SelectedDate,"yyyy-MM-dd") & "' AND '" & _
        Format(DatePickerTo.SelectedDate,"yyyy-MM-dd") & "' ORDER BY TheDateField ASC;

I let to you to verify that the selected to date is greater than the selected from date.

Hope this helps

lolafuertes 145 Master Poster

I would suggest to change all your approach, because 'killing' processes that you don't like is always a bad practice (IMO); better never start them.

Every thing you are asking for can be done through Security Policies.
If the PC, where to run your program, is part of a LAN, and there is a server with a Domain Security enabled, those policies can be managed centrally from the server. If not, you'll need to play with the Software Restriction Policies in the Local Security Policy from the Security Configuration Management in the Administrative Tools of your PC.

If you need support on how to manage it, please post a request in the Windows forum.

Hope this helps.

lolafuertes 145 Master Poster

There are many approaches to solve your issue, and I would suggest two of them:

Use a dataview (a filter over the datatable to locate the right row) , then update it.

Do a foreach loop over the datarows in the datatable. When you find the right row to update, then update it and exit the foreach.

Hope this helps

lolafuertes 145 Master Poster

Please, if this solved this current thread, mark it as solved.

Thanks in advance.

lolafuertes 145 Master Poster

You are retrieving the info from TxtLocation.Text to update the record.

Did you filled this TxtLocation.Text with some data 'coming' from the datatable or just always is a new record to add?

lolafuertes 145 Master Poster

This is because you are using the record number 0 of the Customer datatable to put the new values.

You need to know the shown record position (value for the index instead of 0) to do the updates.

Hope this helps.

lolafuertes 145 Master Poster

Here and there are good places to start from msdn.

Also you can go there for more howtos and examples.

Hope this helps

lolafuertes 145 Master Poster

Maybe the magic can be to create a new module with a Sub Main and use this sub for starting the project in the project properties page.

This sub can do the following:

* Instantiate a new titleForm.
* Show the titleform.
* Do the progress bar movement for the titleForm
* instantiate the logonForm
* Close the titleForm
* Show in dialog mode the logonForm.

Hope this helps

codeorder commented: just because you seem to deserve more rep. points for all the help provided on this forum. :) +10
lolafuertes 145 Master Poster

Probably you need to decode the text from the file using the System.Text.Encoding and System.Text.Decoder classes.

The way is to read the bytes of the source file using an stream reader, convert the bytes using the appropiate decoder and present the result on screen.

Hope this helps

lolafuertes 145 Master Poster

Glad to hear that :)
If this solved the problem, please be so kund to mark the thread as solved.

Thanks in advance

lolafuertes 145 Master Poster

I am unsure about the type of your feeds and feedz.
If this is an array, list or collection, there should be a Count or Length that defines how many selected descendants you got on each.

You can obtain the right property debuging the feeds. Use this to cicle over.

Comments to your code: the foreach structure will cicle over all existing elements in an array, list or collection, starting at the first. If you put a break after doing the first assignement, the next time you start the foreach, will start over the first element again, and this will produce the duplicates.

Hope this helps

lolafuertes 145 Master Poster

Maybe you can use a for loop instead of a foreach like:

XDocument feedXML = XDocument.Load("http://twitter.com/statuses/public_timeline.xml");
                
                var feeds = from feed in feedXML.Descendants("status")
                            select new
                            {
                                Tweet = feed.Element("text"),
                            };

                var feedz = from feed in feedXML.Descendants("user")
                            select new
                            {
                                User = feed.Element("screen_name"),
                            };


                for (int i=0;i<feeds.Count;i++)
                    {
                        textUpdates.AppendText(feeds[i].Tweet.Value.ToString() + "\r\n");

                        textUpdates.AppendText(feedz[i].User.Value.ToString() + "\r\n");
                    }

Hope this helps

lolafuertes 145 Master Poster

You miss to save the settings.

My.Settings.Save() will do the tric.

Hope this helps.

lolafuertes 145 Master Poster

You can install any OS if you have the valid drivers for your hardware.

Hope this helps

lolafuertes 145 Master Poster

Maybe because:
A) the boot sector of the disk has been 'destroyed'
B) the disk is not detected at all
C) There is no disk with valid operating system bootstrap.
D) the disk is 'broken'

You can try to verify the disk for bad sectors in another PC installing it as secondary disk. If the disk is not detected maybe is broken and may be replaced.

If is detected then run a CHKDSK /B in order to re-evaluate the disk for bad clusters, locate bad sectors and try to recover readable info and fix basic errors like jurnal, lost entries or recover NTFS indexes, etc. After that, try to moyunt the disk again in your computer.

If this did not work, you can use the Disaster Recovery Disk you created just after the very first installation of W7 in your computer to try to repair the disk.

If you do not have such a disk, then start from the W7 installation CD/DVD and try the recovery option.

If none of the preceding steps can help, then a fresh W7 installation with full disk formatting may help.

Hope this helps

lolafuertes 145 Master Poster

If this solved your question, please be so kind to mark the thread as solved.

Thanks in advance

lolafuertes 145 Master Poster

We create a function or method in VB using the following:

Sintax for a method:

Sub Methodname
'
' Place your method here
'
End Sub

Sintax for a function:

Function FunctionName as TypeOfReturnValue
'
' Place here your function
'
Return TheValueToReturn
End Function

Please read here (and next chapters) to learn howto.

Hope this helps

lolafuertes 145 Master Poster

Yes, and better in a MySql forum, but...
Always we try to help.

Cheers

lolafuertes 145 Master Poster

The triggers are declared at database engine, so you need to administer MySQL database to create a trigger to do that.

You can find here the reference on how to create a trigger in MySQL version 5.6. On this page you can find manuals for other versions.

Hope this helps.

lolafuertes 145 Master Poster

It seems that you miss the From EmpBenefit clause in yor DAL code line 15.

Is that right?

Hope this helps

lolafuertes 145 Master Poster

IMO, to do that, you need to migrate your database from SQL Server Express to SQL Server, install a SQL Server instance on the server and create the database once.

In this scenario, SQL server will be network reachable. There are several versions and licensing options, but probaby teh SQL server 2008 Standard will be enough for most of applications. See here for editions details.

You must have in mind that this will be a multi-user capable environment and, depending on how you programmed, will be necessary to migrate your application to forceably implement transacions to ensure that insert, update and delete commands execute properly isolated.

Hope this helps.

lolafuertes 145 Master Poster

It seems that the compiler returns an integer as a bitwise operation.

I found nothing stating that the return value should be an integer, but all the examples I found are integer based :(

Also I found that I never used bitwise operations on other types than integer.

Sincerely.