Click here to Skip to main content
15,174,178 members

Comments by Jegan Thiyagesan (Top 140 by date)

Jegan Thiyagesan 4-Oct-13 6:34am View
If you do not access to app.xaml it doesn't matter, whoever calls your MonitorProfileOutputViewModel needs to initialize and set the view model before calling them. The app.xaml is an example where the MainWindowViewModel has been called. if you MonitorProfileOutputViewModel has been called in another file, then initialize and set it there.
Jegan Thiyagesan 16-May-13 13:11pm View
what output are you getting for this code?
Jegan Thiyagesan 16-May-13 7:32am View
show us your code!
Jegan Thiyagesan 14-May-13 7:56am View
Sorry, I missed one more thing;
second for loop should have
oRange.Value2 = itemDataGridView.Rows[i].Cells[j].Value;
Jegan Thiyagesan 14-May-13 7:49am View
No! I didn't mean you add to the namespace it self, use the alias name i.e.

oRange = oSheet.Cells[1, j + 1] as Excel_12.Range;

oRange = oSheet.Cells[i + 2, j + 1] as Excel_12.Range;
Jegan Thiyagesan 14-May-13 7:40am View
ok, then give the full namespace Excel_12.Range.
Jegan Thiyagesan 14-May-13 7:13am View
First you write a message;
Second you send it to the user.

Dumb question is most likely receive dumb answer.
Jegan Thiyagesan 9-May-13 7:41am View
First, I am bit surprise to see, this information is parsed as block of string, in which some values are separated by space and some are by CR. Also there is no identification of what is what. For example the PNR code, in your regex you are looking for 6 characters starts with a space and ends with two spaces, so if the string block has another parameter with 6 characters separated by two spaces, then its doom to failure.

thes block of strings need intermediate steps to chunk them out as headers "from start to the beginning of passenger number '1.', second the passengers and their flight details such as start from '1.' and end on 'FXR', then the third chunk the itinerary and the re booking part.

Once you split the string block into three parts then it will be easier for you to do the conditional checks as you needed.
Jegan Thiyagesan 16-Apr-13 11:59am View
this will give you the permutation of all values in the input1 array.

string[] input1 = new string[] { "a", "b", "c", "d" };
var result = from a in myString from b in myString where a != b select a + b;
string[] array = result.ToArray();

I haven't figured out how remove the repetition yet.
Jegan Thiyagesan 16-Apr-13 10:46am View
What you need is a permutation algorithm and assign the value for each set.
Jegan Thiyagesan 28-Mar-13 6:06am View
Why are you going through the foreach loop but selecting only the first item in the updateStatus collection?
Jegan Thiyagesan 28-Mar-13 5:55am View
Is the View property set to "Details"?
And the HeaderStyle property set to either "Clickable" or NonClickable" ?
Jegan Thiyagesan 22-Mar-13 6:26am View
Again this is an assumption you are making, neither of us know what is the authors requirement.
Any how, In my answer I was providing an alternative option, that instead of allowing the user to enter some inputs and validating them at the end, why not stop the user from entering invalid inputs. If there is a requirement to have the '+' in particular location, it can also be verified in the key pressed event; that is up to the developer.
It is just an alternative way of approaching this issue.
Jegan Thiyagesan 21-Mar-13 5:28am View
Are you sure?
Jegan Thiyagesan 21-Mar-13 5:28am View
Why not? The author did not specifically say that there should be only one + symbol and the location that the symbol.
Jegan Thiyagesan 20-Mar-13 11:07am View
you could stop the user from typing anything other than number or + in the text box if you want, this will eliminate need for regex at later stage.
Jegan Thiyagesan 20-Mar-13 8:06am View
FindControl method takes string as argument, so the ("ddlvtype1" + i+1) automatically converted to string. The addition of i +1 not the type int in place of string are not the problem. The problem is I think is that "ddlvtype1" should not have the "1" at the end. Adding a number to the variable will make the control names start from 11, i.e. if i = 0, ("ddlvtype1" + i+1) = "ddlvtype11" not "ddlvtype1" what it should have been.
Jegan Thiyagesan 20-Mar-13 5:14am View
Display units not at all contribute to the performance of the machine it is connected to. The Graphic card in the machine contribute the performance of the machine, and also the Graphic card which decides (firmware) how many and what type of display units to support.
Jegan Thiyagesan 19-Mar-13 16:16pm View
The line of code "if (buffer.Count() == bytes)" is redundant because you just created the buffer with size of bytes, it will always be true. What you should be checking is
if (bytes > 5)
So that if the bytes read is less than 5 you will not try to access that index.

Second, the DataReceived event sent out when there is some data in the serial buffer, this doesn't mean that the data is full packet i.e. in your case the full 8 bytes of data. So you have to keep the received data separate until you got all the 8 bytes, then process them.
Jegan Thiyagesan 19-Mar-13 15:46pm View
Are you sure you should be looking for control ("ddlvehicles1" + i+1)?
shouldn't this be ("ddlvehicles" + i+1), without the number at the end, because you are adding the number using the for loop.
if i = 0;
("ddlvehicles1" + i+1) = "ddlvehicles11" and
("ddlvehicles" + i+1) = "ddlvehicles1".
Jegan Thiyagesan 19-Mar-13 15:32pm View
Can you post any of your code fragments?
Jegan Thiyagesan 19-Mar-13 15:31pm View
You make a connection to the database using appropriate database driver, once the connection is established, insert, update, delete, etc. using queries.
Jegan Thiyagesan 19-Mar-13 12:05pm View
what type of database i.e sql, My Sql, Sql light, MS access, oracle, etc.?
Although I can guess what database you will be using in a windows phone app, I would rather you tell us.
Jegan Thiyagesan 19-Mar-13 12:01pm View
How much do you know about programming in C# and database? answer to this question may help us to guide you in the appropriate path.
Jegan Thiyagesan 19-Mar-13 10:24am View
What do you mean by the term "Monitor" is this an application monitoring the performance of CPU? or is this refer to "Display Unit"?
Jegan Thiyagesan 19-Mar-13 10:16am View
How this would work?
Jegan Thiyagesan 19-Mar-13 9:24am View
you can always use a label instead of tool tip or context menu. The label can displayed your selected text as well as it can take mouse click event.

Label lbl = new Label();
lbl.width = 100;
lbl.Height = 50;
lbl.Location = new Point(richTextBox1.Location.X + 100, richTextBox1.Location.Y + 100);
lbl.Click += button_Click;
lbl.Visible = false;
private void richTextBox1_SelectionChanged(object sender, EventArgs e)
if (richTextBox1.SelectedText.Length > 0)
// do your football comparison
// then
if (football)
lbl.Text = "this is football";
lbl.Visible = true;

void button_Click(object sender, RoutedEventArgs e)
lbl.Visible = false;
richTextBox1.Text = richTextBox1.Text.Replace("football", "This is football"); // set or append the text here.

// also get the index and the length of "this is football", change the font if you want.
Jegan Thiyagesan 19-Mar-13 8:59am View
See the answer on this link

Remove all GUIDs and "ComVisible" attributes from the class, then switch the [assembly: ComVisible(true)] attribute in the AssemblyInfo-File to 'true'
Jegan Thiyagesan 19-Mar-13 8:49am View
In VS in the "Debug" menu, click on the "Exceptions" sub menu item (or use the short cut key Ctrl+D,E) to open the exception window.

In the exception Window Click on the "Find" button, this will open a search dialog. In the search dialog type "ComObject" and click on the "Ok" button to search for that exception.

The search will highlight the "System.Runtime.InteropServices.ComObjectInUseException" under the tree of "System.RuntimeInteropeServices". Click on the check box "System.Runtime.InteropServies" this will enable all child exceptions. Click ok to close the Exception window, and run the app again. This time the VS will break at the point when the exception occurs. When it breaks look at the code to see what is going wrong. If you cannot see any bug, post the code here.
Jegan Thiyagesan 19-Mar-13 7:50am View
Did you run your app in the Visual studio, or on its own?
Jegan Thiyagesan 19-Mar-13 7:47am View
you still haven't optimized your code as I mentioned earlier.
Jegan Thiyagesan 19-Mar-13 7:45am View
Stick a break point at the line CheckBox chk=(CheckBox)row.Cells[3].FindControl("CheckBox1");, when the it hits, open the "Autos" window (you can find this window under "Debug" menu "windows" sub menu item) and check the type of the row.Cells[3]. Check does it have control named "Checkbox1".

Then step into using the "F10" key, check the value of the CheckBox chk, look whether it is not null, and finally, if you do find that the check box exists, then look for whether has it "Checked" stte set to true.
Jegan Thiyagesan 18-Mar-13 13:44pm View
Can you add bit more sense to your question?
What are you trying to achieve?
What are you trying to avoid?
Jegan Thiyagesan 18-Mar-13 13:39pm View
Can you try to reduce the unnecessary repeated code, it makes the overall code lengthy, difficult to read the code and definitely makes it hard to spot the problem.
Jegan Thiyagesan 18-Mar-13 9:57am View
This is member only cares about finishing off his homework, he doesn't give a toss to learning about coding!
Jegan Thiyagesan 18-Mar-13 9:55am View
Can you repost or edit your code using the "improve question" link.

The line
"sql = "insert into Tb_Faculty_Schedule_Timetable [Name],[Mobile No],[Message];"
is missing the last double quote before the semi colon.
I am not sure this is a mistake while typing this question or this is the actual code.
Jegan Thiyagesan 17-Mar-13 10:10am View
You do not need a variable to keep the index of selected row in listView. List view already has aselected items collection. Assuming that only one item is selected, getting that index will be:

if (listView1.SelectedItems.count > 0)
ListViewItem selectedItem = listView1.SelectedItems[0];

In the case like above, it should be using for loop instead of foreach.

for(int index = 0; index <listview1.Items.count; index++)
if (listview1.Items[index].SubItems[2].Text.Equals(name.Text))
//If text is found, select row at the current index
listview1.Items[index].Selected = true;
label1.Text = listview1.Items[index].SubItems[0].Text;
label2.Text = listview1.Items[index].SubItems[1].Text;
label3.Text = listview1.Items[index].SubItems[2].Text;
//If text is not found, deselect row at the current index
listview1.Items[index].Selected = false;
Jegan Thiyagesan 17-Mar-13 6:03am View
The description of your project sound moderate amount of coding involved, but you saying, the code above is a first code you have written. It sounds you need a lot of homework to do on programming before even you think about doing this project.
Jegan Thiyagesan 16-Mar-13 21:51pm View
Description of your question and your code doesn't match. Where is the code that actually do something, apart from a console application that reads a name?
Jegan Thiyagesan 16-Mar-13 18:27pm View
How does your solution assign values to the label as asked in the question?
What is the point of having that "searchIndex"?
Jegan Thiyagesan 16-Mar-13 7:16am View
Yes, because the salt is random, you need to save the salt that used for creating the hash at the first time, so when the next time user login, you use the same salt. Otherwise if you use new salt, the hash will not be same, although the user enters the correct password.
Jegan Thiyagesan 15-Mar-13 8:42am View
you have been going on about these questions for a week, Is this a piece of homework you are doing at the last minute by any chance?
Jegan Thiyagesan 15-Mar-13 8:30am View
Is this your home work?
What have you searched for?
What have you tried?
Where did you get stuck?

show us your code fragments!
Jegan Thiyagesan 15-Mar-13 8:22am View
Sounds like this is your homework!
what have you searched for?
What have you tried?
where did you got stuck?
Show us your code fragments.
Jegan Thiyagesan 15-Mar-13 6:15am View
Hi Dave,
You are not checking for itemQu for null, Convert.ToIn32(null) will throw exception.

Also according to you code if the itemPn is null, then you not using the itemQu, this is why I have optimized the code in my solution version 4 such that, if the itemPn is null the code will not check for itemQu and you will not need to allocate an extra variable 'exitLoop'. Remember, every line of code is going to allocate some memory and consume time. Remember the less line of code the better the throughput.
Jegan Thiyagesan 15-Mar-13 6:06am View
Hi Maciej,
The "xlsSheet.Cells[iLoop,1]" is a dynamic type, it returns a type during runtime, so during compile time you will not know what type is going to return, according to Microsoft we should be using "dynamic" type as
dynamic itemPn = xlsSheet.Cells[iLoop,1];

string str = (itemPn != null)? itemPn.ToString(): ""; // there is no reason why you shouldn't parse the type as it is, if you know the retuen value is text or a number, rather than converting to string. // half way down the page "Avoid the use of var in place of dynamic".
Jegan Thiyagesan 14-Mar-13 13:43pm View
What are you trying to achieve?
in your code,
you are getting the name of the type, and then the type and the collection of methods in that type, yet you haven't defined what is in the "AllTypes" collection.
Jegan Thiyagesan 14-Mar-13 11:35am View
You cannot call the method directly like frmB.PerformInterfaceMethod(); unless it is static.

from your comments it sounds like you have

1) Form B initialised,
2) Form A open
3) you are trying to access a method in from B from Form A.

in this case parse the Form B as parameter into form A.

public class FormA
From _frmB;

public FormA(Form frmB)
_frmB = frmB;
private void DoSomething()
Jegan Thiyagesan 14-Mar-13 10:32am View
See my edit.
Jegan Thiyagesan 14-Mar-13 4:59am View
As the keys are string, it might be spelled wrong or the columns has not given a key id.

Try a little test to check that all the columns has keys using this code below:

foreach(var column in ultraGrid.DisplayLayout.Bands[0].Columns)
Jegan Thiyagesan 13-Mar-13 14:32pm View
What do you mean by still no luck? can you elaborate where it is going wrong?
Jegan Thiyagesan 12-Mar-13 11:45am View
If you tag this as C++, you might get effective answer. I wonder how many C#ers know c++ :).
Jegan Thiyagesan 12-Mar-13 10:07am View
Hi, how is your code any different from the original code written by the author of the question?

Why converting an object into Boolean, checking if it is "true" then converting to string?

What would happen if the values are false? Wouldn't the query become just series of commas?

What if the value is null, will the compiler convert a null to Boolean? Will that return "true"?
What would happen when with "null.ToString()"?
Jegan Thiyagesan 12-Mar-13 9:01am View
Is this xml file created using a program?
where is the code that is generating this file?

We could help you effectively when you show us what you have tried.
Jegan Thiyagesan 12-Mar-13 8:58am View
What have you searched for?
What have you tried?
Where did you get stuck?
Jegan Thiyagesan 10-Mar-13 18:16pm View
As you have not posted any code fragments in your code, I had to assume that your coding knowledge is limited.

The RichText control inherits from "Block Class", if you read about Block Class, you will know how line height works.

Jegan Thiyagesan 10-Mar-13 11:25am View
A duplicate question has been raised by the same member.
Jegan Thiyagesan 10-Mar-13 10:50am View
when sql can perfectly handle Boolean type, why change to string. In programming if the developer can code something in primitive type, then it should be left alone in primitive type. Converting a primitive type to another type and back again into primitive type is totally unnecessary.
Jegan Thiyagesan 8-Mar-13 4:10am View
You can get the lpram value from winProc() function. but why would you need to get lpram of key pressed in C#? The key pressed event is there if you want to call a function when key pressed. also there are key down, key up events if you need so.

Jegan Thiyagesan 7-Mar-13 17:29pm View

If the value is null, ToString() will throw exception, and nothing will work from that point.

remove the ".ToString()" and have ago.

Jegan Thiyagesan 7-Mar-13 16:03pm View
Text is specified to that range object,
Value is specified to that range,
Value2 is specified to that cell.

although the Text and Value can do the job, value2 is more brute force.
Jegan Thiyagesan 7-Mar-13 15:55pm View
Jegan Thiyagesan 7-Mar-13 15:52pm View
Have you used the "range.Value2" property as in my revised answer?
Jegan Thiyagesan 7-Mar-13 15:06pm View
Well presented answer!
Jegan Thiyagesan 7-Mar-13 3:50am View
It is just a matter of rearranging the for loop, but I cannot test your code as I do not have your complete code.

There are couple of thing, move the using statement section out side the for loop, move the AddQRTag call back inside the for loop, as below.

using (var dc = new DataContext())
// Add record stub for Assessment unless one already exists
Assessment a;
a = dc.Assessments.FirstOrDefault(
c => c.DocumentID == d.ID && c.FeedbackUserID == u.ID &&);
if (a == null)
a = new Assessment()
DocumentID = d.ID,
FeedbackUserID = u.ID,
PageNumber = inputDocument.PageCount,
ID = Guid.NewGuid()
a.LastGeneratedDT = DateTime.UtcNow;

for (int idx = 0; idx < inputDocument.PageCount; idx++)
// Add copy of page to new document
PdfSharp.Pdf.PdfPage newpg = outputDocument.AddPage(inputDocument.Pages[idx]);

// Add tagging to the top or bottom of the page
PdfSharp.Drawing.XGraphics gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(newpg);

string gurl = a.ID.ToString().Replace("-", "");
string gocr = "*" + gurl.Substring(0, 10) + " " + gurl.Substring(10, 11) + " " +
gurl.Substring(21) + "*";

// prep the visible string
AddQRTag(gfx, 3, 3, baseQR + gurl, gocr);

Jegan Thiyagesan 6-Mar-13 10:55am View
What have you searched for?
What have you tried?
Where did you get stuck?

Tell us where you got stuck, then we can help you. We are not here to do the search for you.
Jegan Thiyagesan 6-Mar-13 6:13am View
The whole algorithm is written for 32bit long, you cannot cut it down to 16bit, unless you re-write the whole lot.

Jegan Thiyagesan 6-Mar-13 5:31am View
The whole algorithm is set for 32bit long, you cannot reduce it unless you change the whole Blowfish algorithm to 16bit. you pretty much have to re-write the whole algorithm.

Jegan Thiyagesan 5-Mar-13 12:23pm View
The number of customers entered into customer table per day is the count of number of transactions per day for that table.
Jegan Thiyagesan 5-Mar-13 11:33am View
My apology, I missed the piece of string in front.
Jegan Thiyagesan 5-Mar-13 11:16am View
Wrong answer!
Jegan Thiyagesan 5-Mar-13 11:15am View
Wrong answer!
Jegan Thiyagesan 5-Mar-13 7:20am View
can you post the copy of your dictionary content, as how it is laid out?

Also you are using circular referencing in "go" function, this can go hairy, you should find alternative way to call that increment.

Jegan Thiyagesan 5-Mar-13 7:06am View
I tried your source code in my x64 W7 machine, I did not see any exceptions yet. I even enabled all the exceptions but could not reproduce.

Jegan Thiyagesan 5-Mar-13 5:33am View
Read my questions above!
Jegan Thiyagesan 5-Mar-13 4:46am View
Tell us
What have you tried?
Where did you get stuck?

so we can help you.

Jegan Thiyagesan 5-Mar-13 4:44am View
What have you tried?
Jegan Thiyagesan 5-Mar-13 4:43am View
What have you tried?
Jegan Thiyagesan 4-Mar-13 16:50pm View
Instead of posting your homework here, you should say, what are you trying to achieve, what have you tried, where did you got stuck? so that we can help you.

We are not here to do your home work.
Jegan Thiyagesan 4-Mar-13 9:06am View
Where does the "counter" value get set. if the counter value doesn't change, whichever button pressed, it will always call the same index from the folder array.

Jegan Thiyagesan 4-Mar-13 7:19am View
my code above should work for every sibling in that node tree.
See line "while ((node = node.NextNode) != null);"
Jegan Thiyagesan 4-Mar-13 5:24am View
So what is the problem?
where are you getting stuck?
What feature are you missing?
Jegan Thiyagesan 3-Mar-13 17:50pm View
I am not sure what do you mean by "What am I doing here and Why?"

You may use global variable if the application has some default values that get populated in multiple of forms, if the use changes the default value, the new value will be stored in the data store but if the user decided to revert back to default value, the values from the hard coded global variable will be applied.

In OO the variable are never exposed as public they are always private to the class it is belong to, it is only exposed either as Properties or Geters and Setters.
Here is an article about what a class should do .

const int = this variable will receive a value only during its construction,
static const int = there will be only 1 such class-wide data member.

I hope this helps.

Jegan Thiyagesan 3-Mar-13 15:36pm View
Yes! you can use the background worker to start the second process in separate thread and use the background worker progress event to update your progress bar to notify the user. When the background worker sends the work complete event, then the first process can continue with what it was suppose to do.

Jegan Thiyagesan 1-Mar-13 3:57am View
you need to refresh the Parent form!
Jegan Thiyagesan 1-Mar-13 3:53am View
Hi, you open the file only once, then you iterate through the cells to add values into cells.
so you will have a for loop like this below:

for (int row = 0; row < rowCount; ++row)
for (int col = 0; col < columnCount; ++col)
((Excel.Range)worksheet.Cells[row, col]).Value2 = val;

Jegan Thiyagesan 27-Feb-13 12:32pm View
Hi, I am totally confused with your question and the code block you have posted, Where is the part that restricting the rows when it is more than 5? can you be bit more specific?

Jegan Thiyagesan 27-Feb-13 10:09am View
My mistake , I didn't read it properly, that you said you have added the combobox inside the drop down menu,
try this one:

public void SetFileNames()
string[] Filelistarray = Directory.GetFiles(@"D:\Projects\VS_Test_Projects\WpfApplication1\InfragisticsTest\bin\Debug", "*.txt");
List<string> fileNames = new List<string>();
foreach (string FileName in Filelistarray)
string filenameWithoutPath = Path.GetFileName(FileName);


Jegan Thiyagesan 27-Feb-13 7:44am View
Then you are using a dll that is build for x64. you need to check all your references target platform are correct.

Have you tried with changing the target to x86?
Jegan Thiyagesan 27-Feb-13 7:20am View
Have you made sure that all the projects involved are set to the same target and have you clean the binaries before rebuild?
Jegan Thiyagesan 27-Feb-13 7:03am View
I do not know much of JQuery my friend. Sorry.
Jegan Thiyagesan 27-Feb-13 6:38am View
You cannot change the margin of the fonts, But you can change the Font family to fit in your text box, such as Lucida Console font family with 8px will adjust the height of the text box to 15px, and just about readable.
Jegan Thiyagesan 27-Feb-13 5:05am View
You are again missing the point, Font size and the Text box height are related, if you set the font size to 15px then your textbox height will increase to 30px. you cannot increase one and decrease another, they both will increase or decrease relatively.
Jegan Thiyagesan 27-Feb-13 4:58am View
Yes I understand that.
When the A gets a "buzz" you would do this on the A's chat program wouldn't you?

if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Restore;
FlashWindow.Flash(this, 3);

Jegan Thiyagesan 27-Feb-13 4:49am View
Means your worksheet is null, means your workbook is null.
Did you give the full path to open the excel file? i.e. C:\blalba\blabla\blabla\Excel.xls.

Jegan Thiyagesan 27-Feb-13 4:43am View
"Parallel.Foreach" loop will execute all of your urls at once, if you want to access only 100 urls at a time, but all of those 100 in parallel; then you need to put them inside a for loop with increment of 100.

private void DownloadAsynchronous(List<string> urls)
for (int i = 0; i < urls.Count; i += 100)
string[] urlStrings = new string[] { };
urls.CopyTo(i, urlStrings, 0, 100); // this needs more attention as the array count may be less than the copy count and throw index out of bound exception.
Task.Factory.StartNew(() =>
Parallel.ForEach<string>(urlStrings, url =>

You need to give attention to the urls.CopyTo line as this will throw exception.

Jegan Thiyagesan 26-Feb-13 8:38am View
Can't you change the design, instead of grabbing the data from the list view. you separate the view from model, so that you have the collection of list view items "ListViewItemCollection", you do whatever you want with them in the parallel task and when the background worker replies you with progress, you update the listView with whatever available in the "ListViewItemCollection".

Jegan Thiyagesan 26-Feb-13 7:38am View
I tested it with 1000 item, and i did not see the list view freezing, list view seems responsive.

you must remember the background worker is different thread to the main thread which created the listview. If you try to add items into list view in background worker, you will have cross thread exception.

you can switch off the cross thread check, but I wouldn't recommend.

Jegan Thiyagesan 25-Feb-13 12:24pm View
What have you searched for?
What have you tried?
Where did you get stuck?
Jegan Thiyagesan 25-Feb-13 9:02am View
Can you post the code that you are writing to the Cell?
Jegan Thiyagesan 25-Feb-13 8:47am View
What have you searched for?
What have you tried?
Where did you get stuck?
Jegan Thiyagesan 25-Feb-13 8:35am View
What have you tried?
Jegan Thiyagesan 25-Feb-13 5:48am View
"int" is a primitive type and it will always have a value, you cannot assign null to a primitive type.

if you want you can make your "objdal" to a nullable "Integer" type or a "string" type.

Jegan Thiyagesan 25-Feb-13 5:26am View
Have you tried this in your program:
Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

See link in stackoverflow:

My concern is that, that the Sharepoint is set to German culture, this may over write any of your settings at the point when the data is read from Sharepoint. This is a tricky scenario!
Jegan Thiyagesan 25-Feb-13 4:39am View
It is not specific to my implementation, it is to show that there should be a end of data mark. The user can leave it as it is or change it to something that they want once they know how to.

If I make the code generic, yes, the experienced developers will understand, BUT the beginners will get confused. This code is for a beginner who have never worked on serial comm before to get the gist of how to open a serial port and send/receive data.

Jegan Thiyagesan 24-Feb-13 6:05am View
The code I wrote certainly works in WinformApplication, I am not sure about

The additional code you wrote
if (!ch.Checked)
is wrong, if the first check box is not checked, you will decrement your count (means negative count), further down the multiplication by the negative count will be negative, so the progress bar will not display. In my original code, it will only increment the count if the check box is checked per check box.

Jegan Thiyagesan 22-Feb-13 9:53am View
Can you post the xml file?

Can you also post the code behind the "WorkflowModulCapturaPrelucrareCaptura" and the "WorkflowModulSplitAnalizaSplit" ?
Jegan Thiyagesan 22-Feb-13 8:29am View
Your mc_s data is written to file "C:\Users\SmartAdm\Documents\visual studio 2012\Projects\Workflow_Robo\Workflow_Robo\workflow.xml"

and your mc data is written to "C:\Users\SmartAdm\Desktop\Workflow_Robo\Workflow_Robo\workflow.xml"

These are two different location, so your xml file will show only one data set.

Also can you post the xml data with elements rather than just 1's?
Jegan Thiyagesan 22-Feb-13 4:39am View
I didn't quite understand why do you want to split the date in sql query when you already have a deserialized object. you just have to get that object and pick the date format you want such as

DateTime dt = testIn.PartInfo[0].InstallDate;
string shortTime = dt.ToShortTimeString();

If you are not using the deserializer, then sql.SELECT will give you that date value as string, so you can split on string as

string installedDate = "2013-02-04T17:16:56.383+05:30";
string[] parts = installedDate.Split(new char[] { 'T' });
string date = parts[0];
string time = parts[1]; // remember this includes the +05:30 at the end, you have to take care of this.

Jegan Thiyagesan 22-Feb-13 4:18am View
In this case,
When you read the data from database, why don't you read it as InvariantCulture.
Jegan Thiyagesan 21-Feb-13 10:47am View
Which part actually get written to the xml file and which part doesn't? you seems to have two objects writing to two different files. Is both files writing the first node only i.e. mc_s.M0_RevertSnapshot on the first file and mc.M3_CopyResultonserver on the second file?
Jegan Thiyagesan 21-Feb-13 10:20am View
Your question on the title and the question in the content are two different thing. which one do you need answered?
Jegan Thiyagesan 21-Feb-13 10:08am View
What do you mean by change user setting directly? did you mean in your PC?
Jegan Thiyagesan 21-Feb-13 9:36am View
Are you not binding the data source to the grid view?
Jegan Thiyagesan 21-Feb-13 9:12am View
You can do it that way but it is not elegant. Perhaps you should think of using a separate form for the list box and show/hide them as needed.
Jegan Thiyagesan 21-Feb-13 8:22am View
Uk = Europe
12,345.67 = 12.345,67

regardless of how the number are displayed the database will always store in InvarientCulture that is 12,345.67, BUT when its read, the reader converts to the current culture. As you said that the SharePoint is in German Culture, when its read the database, it will immediately convert to German culture.

The solution would be to force the SharePoint use the InvarientCulture.
Jegan Thiyagesan 21-Feb-13 8:03am View
Have you thought of docking the list box to "Fill"?
Jegan Thiyagesan 21-Feb-13 6:57am View
On the first section of the code your serialising

WorkflowModulSplitAnalizaSplit mc_s = new WorkflowModulSplitAnalizaSplit();

as a type of

XmlSerializer xs_s = new XmlSerializer(typeof(WorkflowModulCapturaPrelucrareCaptura));

I am not sure the serializer will translate this correctly.

Also you could optimize the if statement as follows:

mc.M3_CopyResultonserver = Convert.ToByte( triStateTreeView1.GetChecked(triStateTreeView1.Nodes[0].Nodes[1].Nodes[1].Nodes[12]));

Jegan Thiyagesan 21-Feb-13 5:18am View
Have you tried using the .NEt textbox to eliminate the scenario that the dll might be causing the problem?
Jegan Thiyagesan 20-Feb-13 10:24am View
Where did you add break points?
Are you using any third party dlls?
Jegan Thiyagesan 20-Feb-13 9:52am View
Can you put a break point in "InitialiseComponent()" and run the app, If it does stops at that break point, press the F11 key to step into that method and continue F11 until the exception throws, note down the line that the exception throwed. If the Break point doesn't get hit, then let us know.
Jegan Thiyagesan 20-Feb-13 9:35am View
Where is the Login() constructor?, the code above looks like missing half the page.
Jegan Thiyagesan 20-Feb-13 9:08am View
Hi the stack trace is telling you that some unsafe native method is being called.

System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at AISQBTool.Program.Main() in C:\Users\AISC01\Desktop\AISQBTool_11-2-13_integrated\AISQBTool_11-2-13_integrated\AISQBTool\Program.cs:line 22

Can you post some code from your "Login" class?
Jegan Thiyagesan 19-Feb-13 9:40am View
A very good answer. In fact there should be a filter mechanism in CP website that throws these people out straight away.

Jegan Thiyagesan 18-Feb-13 11:37am View
This is SQL time format, when you serialise this to DateTime object, .Net will automatically recognize that. then you can use that serialised DateTime object to get the correct sreing format you want.

Jegan Thiyagesan 18-Feb-13 9:23am View
Well done!
Carrier Detection is normally done between micro controllers, not on PC, so I assumed you will be using a command, rather than receive line signal.

Jegan Thiyagesan 18-Feb-13 7:21am View
Assuming Application 1 and 2 are separate process, your solution will not work.

Jegan Thiyagesan 18-Feb-13 5:37am View
Why don't you google it?
Jegan Thiyagesan 18-Feb-13 5:32am View
Good one!
Jegan Thiyagesan 18-Feb-13 4:44am View
Hi there is a "broadcast" function in the TCP server, which will sends the message to all connected clients.

Jegan Thiyagesan 18-Feb-13 4:37am View
Hi These codes are for just opening the serial port and setting its properties. There is no code that contains your command protocol. All serial interfaces has some form of command protocol. You need to get hold of the command protocol that applies to your turnstile or use an available hyperTerminal ( to reverse engineer the command protocol from you turnstile.

Jegan Thiyagesan 18-Feb-13 3:55am View
Hi I didn't quite understand your questions.
In serial communication like this, all operations are done through commands, and you must have a sets of command protocol to operate the turnstile that you are working on.

The code above will open the com port and send and receive messages. When the message is received, it will notify you via received event. It is up to you to process the received message according to the command protocol.

I hope this helps.

Jegan Thiyagesan 15-Feb-13 11:01am View
Lot of unnecessary code!

Dont write code unless you absolutely need to.
Jegan Thiyagesan 15-Feb-13 11:01am View
This is very unattractive!
Jegan Thiyagesan 15-Feb-13 10:22am View
Hi I've a lot of automation work, what is your actual problem? can you post your code?

Jegan Thiyagesan 15-Feb-13 6:45am View
Have you tried something like:

((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DDLpursuit")).DataSource = dt_pursuit.DefaultView;

Jegan Thiyagesan 14-Feb-13 3:34am View
Yes That's correct, I missed that one out.
Jegan Thiyagesan 13-Feb-13 12:19pm View
Or use xml serialiser, create an object that contains the xml attributes and parse it.
Jegan Thiyagesan 13-Feb-13 10:46am View
You expect someone to write the code for you? there are plenty of example on google how to read xml file.
Jegan Thiyagesan 12-Feb-13 6:03am View
Can you elaborate your question, serial communications are between two interfaces, writing a file to a disk is using a file or stream writer. Are you trying to read data from an interface and write to the disk?