lolafuertes 145 Master Poster

Maybe you need to close the preceding apostrophe before the WHERE clause like:

"', TIN_No='", rec.txtTIN, "',PAG_IBIG_No='", rec.txtPagibig,
                "' WHERE Emp_ID=",rec.Emp_ID), clsData.con);

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

If this solved your question, please mark this thread as solved.

Thanks in advance

lolafuertes 145 Master Poster

Maybe you need to contact with justhost.com support in order to answer your question.

Cheers

lolafuertes 145 Master Poster

This is starting point to learn how they are hashed.

Hope this helps

lolafuertes 145 Master Poster

Lets separate the problem in parts:
1) Find the returned phrase in a list of known ones
2) Return a random string from svin if the searched phrase does not exists

Lets assume that we already have a list of known prhases like

static string[] knownPhrases = {"You are the best","Can you help me?"}
static string[] knownAnswers = {"You are rightr","Of course"}
static string[] svin = { "Noob Error", "Jeg skal lige have en joint", "Der er rygepause", "Jeg skal lige lave pølle", "Har ikke tid til dit lort", "Kællingen skal lige kneppes", "Hvad snakker du om?", " Skal du ha' slag?", "Min luder er lige kommet", "Du er dum i dit ansigt", "Du er dum og høre på", "Få dig et liv" };

In order to find if the phrase is know or not you can create a function that will return the righ answer or a random one like:

static string GetAnAnswer(string inputPhrase)
{
for (int i=0;i<knownPhrases.Length;i++) if (inputPhrase == knownPhrases[i]) return knownAnswers[i];

Random rand = new Random();
// this will return a non negative value less tha the max supplied
int randvalue = (int) rand.Next(svin.Length); 

return svin[randvalue];
}

Then after reading the input phrase you can :

if (sætning.Length==0) return; // end of 
Console.WriteLine(GetAnAnswer(sætning));

Hope this helps

lolafuertes 145 Master Poster

Yes. That is.

In .Net any form exist until is instantiated.
Th frmMain is instantiated by the CLR bootstrap only if it is the starting form of the project.

If your project starts from a Sub Main in a module, then you need to declare and instantiate the frmMain as any other.

Hope this helps

lolafuertes 145 Master Poster

Videolan player (free for personal use) has the possibility to be used as an ActiveX control an can report most of the metadata related to the media.

Plese refer to this page for more info

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

This happens when no reference to the dll exists.
Please verify if you already refrenced it in the project.


Hope this helps

lolafuertes 145 Master Poster

Can you be so kind to post here the chat part you have written so far where you want to include the search function?

lolafuertes 145 Master Poster

Depends on the FTP server software, OS and the kind of security applied.

Please give us more info to help you.

lolafuertes 145 Master Poster

VB.NET does not istantiates the forms by default as does VB6.

So probably when you Public FormStores As frmMain = frmMain you are expecting that frmMain already exist, but does not.

I would suggest some code like this to instantiate the child form:

Public FormStores As frmMain

Public Sub New (ref formMain)

    MyBase.New()
    InitializeComponent()
    FormStores = formMain

End Sub

Then on the calling form or module

Dim ChildForm as cForm = new cForm(frmMain)

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

Wich is the path you use to open the file?

lolafuertes 145 Master Poster

Unfortunatelly there is no magic ReplaceInTheCurrentCellMovingTheReplacedPartToAnotherCell function in Excel.

I would suggest to do a For - Next loop taking one cell at time in the search range.
Then in the taken cell, define a new text value to set and, for each character in the cell, if the current character is not between "0"c and "9"c, add this character to the destination cell, else add it to the new text value.
After ending the for each, move the new text value to the current cell.

Please let us know if this approach is working for you.

Hpe this helps

lolafuertes 145 Master Poster

Hopefully this pdf from the Education Department can help you.

Sicerely

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

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 the undesired entries.

Hope this helps

lolafuertes 145 Master Poster

You are trying to get a position 128 bytes before the end of file.
As you just created it, the file is empty and the seek position results to be before the BOF.

Hope this helps

lolafuertes 145 Master Poster

I would suggest the following:

When loading the tree view, add the relevant info to find the right record to update (if changed) like the record primary key (or even the full record), into the tag property of the node.

When the node is changed, you can use the info stored on the tag property to cread a command against the database connection, to update the info in the database, and then execute this command.

Hope this helps.

lolafuertes 145 Master Poster

I would suggest using a slider control as a base. Then, maybe you will need to do some additional rendering when showing/updating their content or size.

See here for info about it.

Hope this helps

lolafuertes 145 Master Poster

I would suggest:

1) Use a InFilestream for existing input file and an OutFilestream for a new (and distinct) output file.
2) Use an InBinaryreader for read the original file and an OutBinaryWriter to write the output file
3) For each byte read, write a byte in the OutBunaryWriter unless:
* The read byte is the 268: At this moment
a) write in the output the int value of the length of the new image (4 bytes)
b) get 4 bytes from the input needed to read the length of the old image.
c) Continue the for each

* The read byte is the 296: At this moment
a) Write in the output the image
b) Skip from the input as many bytes as the length of the old image

If you do not have in mind the other headers info and their meanings, probably you will corrupt the file, specially the note_offest (there are 3) and the cover offsets, except if the new image is exactly the same length than the old one.

Hope this helps.

lolafuertes 145 Master Poster

In green my suggestions.

c.con.Open()
Dim j As Integer = 0
Dim cmd As New SqlCommand("select max(staff_id) from staff ", c.con)
Dim dr As SqlDataReader
dr = cmd.ExecuteReader()
If dr.Read() then
    j = dr.GetInt32(0) + 1
    txtstaff_id.Text = j.ToString()
End If
dr.Close()
c.con.Close()

Hope this helps

lolafuertes 145 Master Poster

I would suggest to use

j = dr.GetInt32(0)
txtstaff_id.Text= j.ToString()

You can not use txtstaff_id.Text = dr("staff_id").ToString() because there is no field called staff_id in your select.

When you ask for the MAX(staff_id ) the returned field name is some thing like MaxOfstaff_id.

You can force the returned name to be (IE) MaxId with select max(staff_id) as MaxId from staff and then use dr("MaxId").

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

Maybe inverting the order, first fill the table then refresh the datagrid.

Hope this helps

lolafuertes 145 Master Poster

How do you actually fill the combo?

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

IE: You have a program that opens a file, reads it into a buffer, copies the buffer contents into a richtextbox, higlights the word 'World' if any, and wais for the user to exit it.

If you do a global try catch probably you will have a generic Exception like: Null reference found.

The stack trace, maybe is not enough to determine the right place where this occurs.

Instead, if you do a try catch for every relevant action, you can determine the kind of exception and the action to do in this specific case. IE: determine if the open file function files is due to a bad name or a lack of permissions; in the first case, you can interactively ask to the user for a well formed file name.

As I mentioned before, you will need to have information about the global and local variables content to 'clarify' the origin of the error. In a global try catrch you will loose the info for local variables in other modules, or inside functions or methods.

And yes, it is a lot of work. :(

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

First you must catch the error (that seems obvious)
Then I normally write a plain text file with all the relevant info for the error like:
*Point in the program.class.function where the error occured
*Description of the error, ie exception class, exception message and exception stack
*Variables affected and their current content

Then I name the file with the application name, username, date and time (using microseconds) and the extension of log.

This file can be written in a predefined place in the user PC (preferred) or in a predefined place in a server (you can have communication and/or permissions problems here).

If you write it in the user's pc, you can ask the user to send the textfile by mail to you.

Hope this helps

lolafuertes 145 Master Poster

Probably you will need to refresh each control after changing the databinding.

Hope this helps

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 you need to change your code like

Dim returnedProcess = myProcess.Start(pyLocationDel) 
        returnedProcess.WaitForExit()

See here for reference
Hope this helps

lolafuertes 145 Master Poster

Maybe you can add a new title to the Chart2.Titles collection.

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 can do it using the BibaryWriter class instead of the BinaryReader.

But... there is always a but.

The magic is to know what info exists on the rest of the original header and file, and if this should be changed or moved due to the new size. IE some of the offsets info for other contents in the file, the other contents, etc.

The .ojn is normally used for open2jam songs, and you can find the header info here. Havein mind that if you change the picture size, all the rest of he contents probaly must change their contents or position in the file.

Hope this helps

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

Just have in mind that a 31 days month starting on Saturday can have until 6 weeks.

Lets see a July Month assuming the Sunday is the first day of the week:
Saturday 1, Week 1
Monday 3, Week 2
Monday 10, Week 3
Monday 17, Week 4
Monday 24, Week 5
Monday 31, Week 6

An approach can be: Calculate the Week Of Year for the given date, calculate the Week OfYear for the first of the given month, and return the difference between them + 1.

To obtain the calculation of the week of year for a given date, the function must be aware of the locale date properties (see here for calendar info). I will suggest the following code:

public static int GetYearWeekNumber(DateTime dtPassed)
		{
			CultureInfo ciCurr = CultureInfo.CurrentCulture;
			int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
			return weekNum;
		}

Have in mind that this will work according to the rules to determine the first week of the year and first day of week for this culture (some use Sunday, some use Monday)

Having this function, the rest of calculation can be the following:

private static int WeekOfMonth(DateTime dateToTest)
		{
			var weekOfYearDateToTest = GetYearWeekNumber(dateToTest);
			var weekOfYearFirstOfMonth = GetYearWeekNumber(new DateTime(dateToTest.Year, dateToTest.Month, 1));
			return weekOfYearDateToTest - weekOfYearFirstOfMonth + 1;
		}

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

Also you can help us to help you if you put your database table design here and the errors descriptions or message.

lolafuertes 145 Master Poster

It seems that the current content of the QTR.xml file is in a bad format.

Please post it here to help you to verify it.

Sincerely

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

As a suggestion, if you set the maxvalue of the progressbar to the size of the file to compress, you can increase the bar value to the source bytes already compressed after each compression block.

Hope this helps