|
hi i want know how build my own components with C# for my program but i dont have much knowledge with C# some one can tell me how i do?
thanks!
|
|
|
|
|
Well, first of all, I'm not sure what you mean exactly. A button that drop a menu ? That's an item you can add to your form. Second, if you 'don't have much knowledge', then you should buy a book and work through it, so you learn to program instead of just hoping that people online will give you code you can copy and paste blindly.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have been working on this issue for a few hours and finally found a work-around. This is not a pressing issue, but I am curious about getting more info. I also wanted to share my findings in case anybody else struggles with this. If you have a few minutes and you're curious too, read on...
Here are the steps to reproduce:
The first steps to set up and show a working situation...
1) Create new C# Class Library project
2) Build solution
3) Go to Data -> Add New Data Source...
4) Select Object and click Next
5) You should be able to browse to the Class1 class
Steps to cause the issue...
6) Create new folder and name it 'a'
7) Drag Class1.cs into 'a'
8) Rebuild solution
9) Go to Data -> Add New Data Source...
10) Select Object and click Next
11) The list of objects is empty while it shouldn't be
Steps to fix it again...
12) Add new class (accept default name)
13) Rebuild solution
14) Go to Data -> Add New Data Source...
15) Select Object and click Next
16) Both Class1 and Class2 show up in the list
The oddest thing...
17) Remove Class2.cs
18) Add empty text file
19) Rebuild solution
20) Go to Data -> Add New Data Source...
21) Select Object and click Next
22) Class1 show up in the list
The conclusion is that you must have a file in the top level directory of a project, or otherwise you cannot add an object data source. In my project, I just added a dummy class in the top level for now, because I have nothing useful to put in the top-level folder right now.
Another conclusion is that this has nothing to do with the namespace of the class or the default namespace of the project. You can put Class1 in namespace xxx.yyy, and it will still be found, as long as there is a file (ANY kind of file) in the root.
My questions to you are:
* Can you reproduce this issue?
* Is there any reasonable explanation for this?
* Do you consider this a bug in Visual Studio?
* If so, is this a known issue? Any references?
Thanks,
Martijn
modified on Tuesday, September 8, 2009 6:25 PM
|
|
|
|
|
I am using Microsoft Reporting services (locally).
I have a subreport which works by itself. The report has several parameters, which I programmically pass. I want to embed this report into another report. I added it as a subreport to the main report using the designer.
What code behind do I need? How do programming pass the parameters to the subreport?
Thanks
Marc
|
|
|
|
|
I'm very rusty in this area but I'm positive you can link the sub reports parameter to the main parameter without using code.
|
|
|
|
|
Hello,
I have been working on a new project of a newtork game by this method:
http://www.codeproject.com/KB/game/eatergame.aspx
I was trying to create a trivia game including 4 answer and 15 second to answer each one. for that
I have created a Question class.
The problem started While I had to create a shared time(to make sure all the clients will have the
same time as the server) so I used an extra listening thread in the Question class(it comes from
showdialog());
Everything works fine , until the 4th,5th question (something the 3rd) when the Question class
(which is a form by itself) loads too slow (like 10 sec) when the timer is already done.
I was thinking to create a Show() method instead of ShowDialog and use the Server class but it
won't work because of multithreading(It's stuck).
I would like to add I used two function I saw in net:
"threadname".abort()
"threadname".join()
also I tried to give the Question variable (which created each time in a thread) a null value and use
GC.collect()
I'm stuck , I hope someone can help me(if something isn't clear I can send you the SLN (source)
file).
Thanks alot!
|
|
|
|
|
Stop using Thread.Abort. It's bad. And GC.Collect is mostly useless - why are you using it?
|
|
|
|
|
Nothing you said is clear, except you used a lot of bad stuff and it doesn't work.
Don't send anything to anyone, simplify your code i.e. make it (almost) work without Thread.Abort
and without GC.Collect, make sure your threads terminate naturally and objects that have a Dispose() method get disposed; it problems persist, show the essential part(s) of your code.
Also make sure to catch and deal with all exceptions and log their Exception.ToString().
|
|
|
|
|
Thanks for the answers but I didn't understand some:
first of all how can i make sure a thread is being closed automatically?
second, I removed all the GC.collect, the Thread.abort and the code looks fine, I'll show you a piece:
Server:
doClientMove(){
timer = 15;
Random questionSend = new Random();
string qID = "ID:" + questionSend.Next(1, 5).ToString();
q = new Question(int.Parse(qID.Substring(qID.IndexOf(":") + 1, qID.Length - (qID.IndexOf(":") + 1))),host);
host.c.sendObject(1, q._questionString + "$" + q._questionAnswer + "$" + q._questionMis1 + "$" + q._questionMis2 + "$" + q._questionMis3 + "$" + q._rightAnswer + "$");
}
it creates a question , sends it to Client and wait to get back a sign to open a question by itself.
The Question:
Thread for the server constructer;
private void f1()
{
while (1 == 1)
{
if (_gameStart == 1)
{
int i = 15;
while (i > 0)
{
a.Text = i.ToString();
Thread.Sleep(1000);
i--;
host.c.sendObject(1,"PSYDOWN");
timer--;
}
_gameStart = 0;
this.Close();
}
}
}
Thread for the client constructer
private void f2()
{
while (1 == 1)
{
if (_gameStart == 1)
{
int i = 15;
while (i > 0)
{
a.Text =timer.ToString();
i =timer;
//a.Text = i.ToString();
//Thread.Sleep(1000);
//i--;
}
_gameStart = 0;
this.Close();
}
}
}
//server listening until the timer is over.
public void listening()
{
IFormatter form = new BinaryFormatter();
object geting = null;
ntStr.Flush();
string move;
while (timer>0)
{
if (ntStr.DataAvailable)
{
geting = form.Deserialize(ntStr);
move = (string)geting;
if (move == "PSYDOWN")
{
timer--;
}
}
}
}
What's wrong? Maybe I shouldn't share a timer? just open to each form a diffrent timer and hope it will sync?
Please , I am stuck ; what can i do??
|
|
|
|
|
Okay I found the problem:
Instead of creating a listening thread of the Server Question Class to share the timer between the Clients , I just added a timer inside The question class itself without any thread sharing it.
I mean a question is being opened with a timer instead of waiting for a value each sec from the host.
I don't understand too much in Net , could it be that although two timers start at the Question Class - one of the server and the others of the client wont be sync? (If someone lags or something)?
|
|
|
|
|
Hi,
a thread terminates when its main method returns, i.e. when all its work is done. And that should be the normal way for thread termination.
I'm not sure what YOU mean by timer, your code seems to hold some variable called "timer" which gets decremented; however that is not a timer, a timer would be an instance of Windows.Forms.Timer, Windows.Threading.Timer or Windows.Timers.Timer, i.e. some object that increments or decrements automatically at regular intervals and offers some special functionality, e.g. executing a handler.
And I did not really work my way through your code as it lacks PRE tags and formatting (indentation).
|
|
|
|
|
plz help me im preparing a web page contaning Name, Address, City (DrpDwnList), Country(DrpDwnList),.i want taht when im clkng on country's drpDwnLst then city's ddl should change automatically. so what code i wrote on Pageload, city drpdnlist' selected index chang.
plz help me
|
|
|
|
|
Start by reading this[^]
C# is not subject, it's the forum you are in. Also, your question seems to apply to ASP.NET; there is a forum for that.
only two letters away from being an asset
|
|
|
|
|
Friend,
No one has so much free time to write your code. If you want there are people here [^]who would write a loads of code for you.
I would suggest you to buy a book and start reading. That would help you in a longer run.
There are tons of tutorials, articles on internet available for it too.
You can also take a look here [^]to get started.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
You should buy a basic book and read it. You should forget this project ( I assume it's not paid work, you're not that dishonest, right ? ), and just work through a book to learn these sort of basics.
Then when you know enough to write your own code, if you get stuck, you can ask in the ASP.NET forum
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all,
I wrote a C# application that uses several DLLs. The application will be used by about 20 people over a network. I would like to install the application on the server - and have everyone run it with a mapped shortcut. It seems after googling it - it isn't possible - which seems very odd to me.
I have installed the program on the server, added the assemblies to the sever GAC. When I am logged into the server as a admin user I can run it just fine.
However when I try to run it from my local client machine, I get a security issue. It seems that the program cannot access the "network structure" (which it needs to be able to do in order to connect to a DB).
I checked user permissions and they are correct (full read/write). I also lowered my intranet trust level. What am I missing?
Thanks
Marc
|
|
|
|
|
Consider using ClickOnce deployment.
only two letters away from being an asset
|
|
|
|
|
It is possible but it means altering the code access security policy on every client machine.
As has already been suggested, it's easier and safer to use click once so each client has a copy on their machine that can automatically update from the server.
|
|
|
|
|
How do I manage the updates?
Any good references for on how to develop updates to an application? I usually just recompile and overwrite - but I am sure there is a better way.
Thanks
|
|
|
|
|
There's loads of references and tutorials around. MSDN[^] is a good place to start.
|
|
|
|
|
|
Hey Marc
I've had similar problems compiling my application for .Net 3.5, I found out that it was a bug in the framework and .Net 3.5 SP1 fixed it for me.
Hope this helps
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
I am developing a C# application.
I have to generate a network diagram in c#,how should i do it???
is there any plugin for it??
Please paste some source code
|
|
|
|
|
Does this[^] helps?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
liveinweb2.0 wrote: Please paste some source code
That's a bit insane. You should read the guide on how to ask questions. C# help is what every subject line would be in here, if it was a good header.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|