|
Thread th = new Thread(delegate()
{
e.Graphics.DrawEllipse(new Pen(Brushes.Aqua, 10), new Rectangle(20, 20, 20, 20)); //this line throw new exception "Invalid argument"
});
th.Start();
help pls
|
|
|
|
|
|
First you are not passing the eventargs variable e into the delegate function.
Secondly, you cannot perform GUI operations from any thread except for the one on which the form was created.
|
|
|
|
|
form1.CreateGraphics() and this is workling in other thread
|
|
|
|
|
Just because you can do it doesn't mean it's a good idea. You're still going to run into issues somewhere down the line. You absolutely cannot do any drawing to the controls on a thread other than the one the control was created on.
|
|
|
|
|
Hi!
I have a dataset colum wich values ara simple integers.
I want to create a ComboBox with some string values, and databind the dataset as an INDEX to them.
So,
dataset has 1,2,3,4
my Combobox has "myString1", "myString2" (I can popolate manually or progrmatically, but theese values are NOT provided by the dataset)
I want to databind my dataset to my combobox so that when dataset value is 2, the combobox show "myString2".
I think it should be easy... but i'm not too used to combobox neither databind
Thanks!
|
|
|
|
|
If you set the datasource for a combobox then the datasource must contain both the ValueMember and the DisplayMember otherwise it will not work.
in order to databind the ValueMember must point to a corresponding value in the datasource
eg.
Your datasource for the combobox would be a datatable such as:
ID VALUE
=============
1 myString1
2 myString2
Your dataset would have a column in the table (MyTable) containing the idStrings value for example.
MyCombo.DataSource = source;
MyCombo.ValueMember = "ID";
MyCombo.DisplayMember = "VALUE"
MyCombo.DataBindings.Add("SelectedValue", MyData, "idStrings")
|
|
|
|
|
Hi,
I am an asp.net application developer(C#). I want to move away from building just web applications. I want to know where my knowledge of C# or .NET can be applied apart from building web applications?
Regards,
|
|
|
|
|
Oooooh! Let me think....
Desktop applications?
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Pretty much anywhere, just like Java, C++ etc. Windows apps, services, console apps, you name it. There is also a port of .net called Mono which can be compliled for/under multiple environments (such as linux).
Obviously you'll need to get to know some different framework assemblies/namespaces. If you are interesred in GUI work I found the transition from (mostly) ASP.Net to WPF less harsh than Winforms.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
keefb wrote: There is also a port of .net useless pile of steaming dog mess called Mono which can be compliled for/under multiple environments (such as linux) which would be quite usefull if it was ever finished.
FTFY
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Mono is quite useful for writing Linux or cross-platform apps.
Of course, if you are looking for a magic way to port your Windows-only app to Linux without having to spend any effort, Mono isn't what you are looking for.
WinForms is crap since any non-trivial WinForms code must rely on P/Invoke or overriding WndProc which is platform-dependent.
So just like other programming languages, if you want a cross-platform app, you must use a cross-platform GUI toolkit like GTK#.
WPF isn't implemented in Mono and won't be anytime soon. Silverlight/Moonlight might be an alternative, though.
That said, non-GUI code usually runs fine in Mono. The only trouble I had were hard-coded line endings ("\r\n"). I had no trouble using new language features like LINQ.
|
|
|
|
|
If moonlight is as well implemented for silverlight as mono is for .NET, then expect problems: big problems (where they can't be bothered to implemnt the boring stuff they don't use), small (where they don't implement it quite the same), and bl**dy annoying little differences that waste way too much time to find.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
I got great help with postings of Dr. Wisam E. Mohammed.
I have a question/query for all those working with mapwindow activeX.
I've added a shapefile of 'countries' to the mapcontrol(mapwingis.axmap). Now i need that upon clicking/selecting a shape, particular information to be showed.
I tried the coding on mousedownevent but i think mapwingis events are not working??
help!!!
|
|
|
|
|
I suggest you find a forum specialized in the use of the mapwindow activeX control. You might get some help here, but it will be more likely on a dedicated forum.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
mayank4everurs wrote: mapwindow activeX
Never heard of it.
|
|
|
|
|
Hi all,
I'm trying to get the global hotkeys working with Linux.
With Windows it is DLLImport user32 but this dll doesn't exist in Linux.
Has anyone an idea how to get global hotkeys working with Linux?
Thanks to all.
|
|
|
|
|
hii man,
you need to write your own implementation of GlobalHooks in c or c++
write down a library and use that one in your c# application or on linux..
grretz
|
|
|
|
|
Thanks for this hint.
But if i do so, ill have to install this lib on every client. Am I right? Or is there any posibility to deliver this lib with the C# project.
I'm not familiar with c#. I use to work with Linux and C++ so if this Questions are a little stupid ... please don't matter
greatz
Armin
|
|
|
|
|
yeah in windows you need to deploy the lib/dll like by installing the app.
using the lib in linux need to be recompiled under linux because the operating system specific api will be used and that one is different as the on in windows see the user32.dll doesn't exists under linux.
hope i could help 
|
|
|
|
|
yeah sure, but now i feel a little stupid ...
Using Windows and user32.dll everything works but what do i have to use for Linux.
With C++ it's easy to use global Shortcuts but I don't get it to work in .NET
If anyone has a bit of code to put me to the right way ... the one would be my hero
thanks
Armin
|
|
|
|
|
Hey guys =),
I want to create a ".xls" and ".xlsx" file in C#2008. Creating && saving is no problem, but how can I close it?
I think I've a bug in my code...
Microsoft.Office.Interop.Excel.Application excelApp = new ApplicationClass();
Microsoft.Office.Interop.Excel.Workbook newWorkbook = excelApp.Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
Microsoft.Office.Interop.Excel.Sheets excelSheets = newWorkbook.Worksheets;
string currentSheet = "Tabelle1";
Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelSheets.get_Item(currentSheet);
worksheet.SaveAs(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\SaveAsTest.xlsx", t, t, t, t, t, t, t, t, t);
but now the question is... "how can I close this worksheet?" a ".close" property doesn't exist...
I read, that I can close the workbook but the workbook uses a already existing file.
Is it possible to assign the new created to a workbook?
greets Mschauder 
|
|
|
|
|
It looks like you need the Application.Quit()[^] method; don't you just love Microsoft?
MVP 2010 - are they mad?
|
|
|
|
|
Hey, worked fine!
Now the next problem... my computer uses office 2007, I can open the ".xlsx" && ".xls" file smoothly...
But if I use the laptop with office 2003... sure I can't open the ".xlsx", but why can't I open the ".xls"???
Is there a possibility to save the file, with the natural format for office 2003 (.xls)
greets Mschauder 
|
|
|
|
|
I answer now my own question (sorry!):
just use:
t means
object t = Type.Missing;
worksheet.SaveAs("Test.xls", XlFileFormat.xlExcel8, t, t, t, t, t, t, t, t);
and saving as office2007:
worksheet.SaveAs("Test.xls", t, t, t, t, t, t, t, t, t);
|
|
|
|