|
You see the code of StartConnect. I think and hence wanted to add StartConnect() in a thread and catch exceptions like that, but it didn't work out.
Is it better to handle it in thread (the code that's commented) or as I have dneo is correct. If the commented is correct, then how to trap exceptions that are thrown by StartConnect or not to throw exceptions and handle them in that method only.
Please guide me for this also. I am on this issue from last 3 days, on many trials couldn't suceed. Your points are helping to suceed. Thanks a lot. I highly appreciate it. Please keep helping on this issue and help me run the code normally to its and yours best.
Thanks & Regards,
|
|
|
|
|
From looking briefly at your code, I think you first need to read up on threads before you try moving the code: you don't seem to understand what you are trying to do and the effects it has on execution.
Read up first, and get your head round it. Then try it, and if you have problems, post a new question!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Truly telling I read Threading tutorials of C#, but not getting such ways of threading. I mean calling method in it and such.
I get threading of Java & C++ nicely, but C# can't get in mind properly.
If StartConnect is in a Thread, it cannot throw exceptions. If adding such type of code in a thread is best practice, then how to accomplish such activity as I have done. If I am wrong in my this thought, please tell me.
Without putting in thread (the current situation), its working proper & also showing exception of cannot find file only. Thanks a lot for this. Please if you can help with the above also would be great. Atleast guide, I am not asking for written code. As said, this type of threading doesn't fit proeprly in my mind, so need assistance.
Thanks & Regards,
modified on Thursday, February 3, 2011 9:38 AM
|
|
|
|
|
Maybe this[^] is what you want.
|
|
|
|
|
Hello
I'm developing a project with C# 2010.
I want to set paper size and layout programmatically.
But it doesnt work properly.
There is no usefull document at the web.
Regards
|
|
|
|
|
Please be specific.
Let us know what you have tried with a piece of code and what error you got.
Praveen Raghuvanshi
Software Developer
|
|
|
|
|
Thank you.
I created my Report and i can see it at run time, But for printing, everytime user should open printer settings and change the paper size.
i want to set paper size at design time and print the report programmatically.
I wrote below code (doesnt work):
this.reportViewer1.PrinterSettings.DefaultPageSettings.PaperSize.Height = 1169;
this.reportViewer1.PrinterSettings.DefaultPageSettings.PaperSize.Kind = PaperKind.A4Extra;
this.reportViewer1.RefreshReport();
Also i couldn't find PrintReport option for ReportViewer.
|
|
|
|
|
Hi Experts,
there is a control derived from System.Windows.Forms.Panel that I can drop things on. The panel shows a representation of what was dropped onto it. Further, I can drag things around on that panel, moving the representation in the process.
Now I have to change that behaviour in such a way, that representations get created OnDragEnter. Customers shall move things around without having to drop them and grab them again.
Now my problem is that OnMouseMove doesn't fire during drag'n'drop operation. Therefore, panel creates a representation OnDragEnter, but refuses to move it around until user releases the left mouse button.
Does anyone know of a solution for that problem?
Can I abort a drag'n'drop operation (there's no drgevent.Cancel)?
Ciao,
luker
-- Modified Friday, February 4, 2011 6:17 AM
|
|
|
|
|
Would this[^] help with the drag image?
There's a DragAction.Cancel property. Any good?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Since DragAction.Cancel belongs to
protected void OnQueryContinueDrag(QueryContinueDragEventArgs e) , which is overridable, I can at this point find out, wheter to continue the drag operation and this works as expected.
Thanks a lot.
Ciao,
luker
|
|
|
|
|
hey guys..i have a bound datagridview in my form and i have two DataGridViewButtonColumn(Edit and Delete)...and the user can add new row..the problem is i want the DataGridViewButtonColumn to be seen as Insert and Cancel instead of Edit and Delete...after inserting process completed it must be seen like other datas..thanks for help
vemedya.com
|
|
|
|
|
erdinc27 wrote: after inserting process completed it must be seen like other datas
Not exactly sure what you mean by this, but, it sounds like perhaps you should use a TemplateColumn and adjust the button controls as required.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hii Mark thanks for reply.. i am searching that u suggested...here the pic what i mean..i mean when i have empty row as in pic the buttons' text must be seen as Add and cancel instead of Update and Delete...and after the user click Add button the row will be added(here no problem) and the button's text must be seen like Update and Delete..like the other buttons..i hope it is more clear now..thanks for help again
vemedya.com
|
|
|
|
|
Handle the RowDataBound or RowCreated event and update the button text appropriately.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
i couldnt find both events that u suggested...i have UserAddedRows and RowsAdded..i tried both
private void datagridview1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
datagridview1.CurrentRow.Cells[6].Value = "Insert";
}
i cant catch Text Property here..that is why i used Value property but it gives error like "Object reference not set to an instance of an object."
so what else i can try ?
vemedya.com
|
|
|
|
|
hi again.. thanks for help and your time..i solved my problem like below.in my button's click event that i create new row
int rowCount = datagridview1.Rows.Count;
DataGridViewButtonCell buttonCell = (DataGridViewButtonCell)datagridview1.Rows[rowCount].Cells[6];
buttonCell.UseColumnTextForButtonValue = false;
buttonCell.Value = "Insert";
vemedya.com
|
|
|
|
|
Hi
I want to bind my combobox with data like
January 2011
Februry 2011
..
..
..
December 2011
Also If current month is january it also show
November 2010
December 2010
else if Current month is Februry it should also show
December 2010
Is there any sql query so that I can get this result.
Please Help
Thanks in advance
|
|
|
|
|
This[^] may help.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
this is my code
private void Form2_keydown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Up)
{
You.Location.X = +1;
}
}
and this is my error
You.Location.X = +1;
can some one plz help me, because that code makes sense to me, what did i do wrong, the thing im trying to move is a picturebox
|
|
|
|
|
You cannot change the Location. It´s readonly. You can use the Left or Top property (I never know what X/Y is ...)
I cannot remember: What did I before google?
|
|
|
|
|
Shouldn't this be You.Location.X += 1; ? BTW, you haven't actually shown what your error is, you've just shown where it is.
|
|
|
|
|
Error1 Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable C:\Users\Kyle\documents\visual studio 2010\Projects\Game 1\Game 1\Form2.cs 42 17 Game 1
|
|
|
|
|
You can't change the values of a Point: they are read only.
Create a new point instead:
private void Form2_keydown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Up)
{
You.Location = new Point(You.Location.X + 1, You.Location.Y);
}
}
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
The online help for the Location property describes the behaviour and how to resolve your problem.
Control.Location Property "Because the Point class is a value type (Structure in Visual Basic, struct in Visual C#), it is returned by value, meaning accessing the property returns a copy of the upper-left point of the control. So, adjusting the X or Y properties of the Point returned from this property will not affect the Left, Right, Top, or Bottom property values of the control. To adjust these properties set each property value individually, or set the Location property with a new Point."
You.Location.X = new Point(You.Location.X +1, You.Location.Y);
Architecture is extensible, code is minimal.
|
|
|
|
|
Assuming You is a Control:
You.Left++;
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|