|
u have to bind the two textbox to the same datasoure and the data will apper automatically
all waht u have to do is to put this code to the Load event
private void Form1_Load(object sender, EventArgs e)
{
this.testTableAdapter.Fill(this.database1DataSet1.Test);
comboBox1.DataSource = this.database1DataSet1.Test;
comboBox1.DisplayMember = "Name";
textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.database1DataSet1.Test, "Id", true));
textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.database1DataSet1.Test, "Address", true));
}
|
|
|
|
|
Read this[^] and update your question to the guidelines.
No one will "give" you code, you will need to write it yourself. If you want ready-to-go code, try here[^].
|
|
|
|
|
Hello everyone! I would like to know how I can read metadata of exported types using the Managed Extensibility Framework. I am using Visual Studio 2008 with .Net Framework 3.5.
In .Net Framework 4.0, this can be achieved through type 'Lazy' but this is not available in .Net Framework 3.5.
Since 'ExportMetadata' was provided in the version of MEF provided for .Net Framework 3.5, I do believe there is a way of reading the metadata in the framework 3.5 but I don't know how this is done. Any guidance, please?
|
|
|
|
|
Well I found out that 'Lazy' is available in MEF Preview 9 for .Net Framework 3.5.
I was previously using MEF Preview 5 which did not contain 'Lazy'. Thanks.
|
|
|
|
|
Hello All,
For each solution I have created, I have been adding the installing NLog for each of the solution. It is adds the NLog.config file.
Since I have different solutions, it is always adding the file as Nlog.config.
can I change this name, and give it a name specific to the solution? change the Nlog.config to SolutionA_Nlog.config?
Thank you!
|
|
|
|
|
I havent used NLog before but if you application is executable you can add the NLog Config information to AppConfig.
check this link[^] more details on how to configure NLog Config
Jibesh V P
|
|
|
|
|
vanikanc wrote: can I change this name, and give it a name specific to the solution
I believe so but why would you do that?
Presumably by "solution" you mean deliverable executable. If so each should be installed into their own directory and have their own log file. And so the same name is probably better.
|
|
|
|
|
Awesome! I like the idea of creating each exe having its own directory.
And yes, by solution I did mean executables.
You see we currently have something set up, where everyone copies their executables at the root of the folder. No structure what so ever!!
|
|
|
|
|
vanikanc wrote: where everyone copies their executables at the root of the folder
Certainly not what I would suggest. Makes updating a single deliverable which has shared dependencies impossible.
|
|
|
|
|
Hi,
I have created a .net 4.0 windows form project.
It is on my laptop. In development.
I need to reference a dll from another server into this project.
How can I do that?
Thanks so much!
|
|
|
|
|
seriously!!. it's not a good idea to refer a file from a shared path. your application will fail if you try to deply/run in other PC.
btw what's you real problem? and what is the role of the referring dll??
Jibesh V P
|
|
|
|
|
as per jibesh - it doesnt sound like a good idea .. the most stable ways I can think of are
a) get a copy of the dll for your dev machine - transfer by usb/email/carrier pidgeon
b) map a permanent share to the machine where the dll is and reference the dll on the path
Unless you're back in the good old days of c++ rpc, there's no way to request dll type services over the net (and even then, rpc requires/required a mapping and comms layer to do so)
'g'
|
|
|
|
|
When you add a reference over the network, the IDE will make a local copy of this dll anyway.
So, nothing should be stopping you from copying the dll to your own machine / project folder and referencing it from this local location.
|
|
|
|
|
i use c# with asp.net ,i didn't understand how to add zoom bar to my google map.
in the aspx file the map configure like this:
<cc1:gmap id="GMap3" runat="server" width="850px" height="500px" language="he"
="">
and the key is configure in the cs file.i saw lots of exsample but evrything in aspx file ,and if i try to change there something i have error in the visual studio.
so i hust want to know how to add this zoom bar in the left
|
|
|
|
|
That GMap declaration looks like it belongs to a control in your solution. That is the area you need to look at, and the code is probably going to be in JavaScript.
|
|
|
|
|
Have a self-hosted WCF REST service w/ custom authentication (UsernamePasswordValidator). I need to return business specific errors from the validator. All methods I have tried to do this with have failed because all the errors get hidden by the HttpWebRequest object in a generic "Forbidden." error. My latest attempt was to write an error code back. Normally, I would do this by using the OperationContext.Current to get the response stream, but OperationContext.Current = null. How does one initialize this in a self-hosted service?
|
|
|
|
|
I have a form with a progressBar on it. I'm doing writes in another class (through my interface) and need to show my progress of doing the writes, but I'm getting an error message *. Hopefully someone has an idea how to get the error to go away and so I can update my progressBar from a different class.
I'm more of a C++ developer doing C#, so there might be something that an experienced C# person would know of that I'm missing.
It looks like this:
PC.cs [Design]
Form with progressBar displayed
PC.cs
private int writeIt(ref byte[] wDat, byte[] sDat)
{
result = cr.ProcessTWriting(ref wDat, ref pb_Progress.Value);
}
* In the code above, I'm getting "A property, indexer or dynamic member access may not be passed as an out or ref parameter" error message.
My interface looks like this:
iCR.cs (which is in another VS project due to future CR6, etc. which will use the interface)
int ProcessTWriting(ref byte[] wDat, ref int pb_value);
Then, I want to pass my references (to progressBar value) to where I'm writing my bytes (i to 1024), and update the reference to the progressBar as it iterates through, writing to it's destination.
This would be in my CR5.cs which implements iCR.cs (and is in another VS project still...think Factory pattern):
public int ProcessTWriting(ref byte[] WDat, ref int pb_value)
{
status = AttemptWrites(ref pb_value);
}
And the method it calls:
private int AttemptWrites(ref int pb_value)
{
for (int i = 0; i < ((wDat.Length) / 4); i++)
{
}
}
Does anyone have a suggestion how to get my progressBar to update as I iterate through each byte I'm writing in my other class? I've looked at a couple of similar situations and there do seem to be people passing an index of an array, but I'm having trouble figuring out how to apply them to my situation. If I assign pb_value to a temporary value, passing it as a reference, it won't update my progressBar.Value as I do my writes and update the temporary reference to the value. Here's the links I found on the topic:
http://stackoverflow.com/questions/4813289/a-property-indexer-or-dynamic-member-access-may-not-be-passed-as-an-out-or-ref[^]
http://stackoverflow.com/questions/12440013/a-property-indexer-or-dynamic-member-access-may-not-be-passed-as-an-out-or-ref[^]
http://stackoverflow.com/questions/4518956/a-property-or-indexer-may-not-be-passed-as-an-out-or-ref-parameter[^]
http://stackoverflow.com/questions/6492097/a-property-indexer-or-dynamic-member-access-may-not-be-passed-as-an-out-or-ref[^]
Hopefully it's not TMI, but I figure, the more info the better so people can see where I'm coming from.
|
|
|
|
|
Sorry in advance for my english. Possibly is not good enough yet...
Do you have the possibility to change your interface?
I'm thinking that a solution to your problem could be the use of events on your CR5 class. (Observer pattern)
You could create an event on CR5 class that can be subscribed by the class that contains the progress bar. Then, you can fire your event on the AttempWrite function with a parameter that indicates de current progress value to set into the progress bar.
Is it a possibility? Or are you constrained to this interface contract?
|
|
|
|
|
That's a good idea. I'll give that a try. I can absolutely change my interface. That's why I'm showing the progressBar value in the interface now. I'm not absolutely sure how to send a value when I fire an event, but I'll take a look. Thanks!
|
|
|
|
|
MichCl wrote: I'm not absolutely sure how to send a value when I fire an event
Create your own event and with that, you create your own event arguments class to carry the data you want to send in the event.
|
|
|
|
|
This sample might help you to get going with event usage
public delegate void ProgressChangeHandler(int progress);
class MyClass
{
public event ProgressChangeHandler ProgressChanged;
public void Process()
{
RaiseProgressChange(progress);
}
private void RaiseProgressChange(int progress)
{
if(ProgressChanged!= null)
{
ProgressChanged(progress);
}
}
}
Jibesh V P
|
|
|
|
|
I'm still not sure about the event with parameters!! If I had the delegate above, how would that be used to fire an event and notify the method waiting for the integer value? I started with this, but I'm not sure how to have an event call it. I was looking at this link: http://stackoverflow.com/questions/1488099/call-an-eventhandler-with-arguments[^]
private void _updateProgressBar(object sender, EventArgs e, int i)
{
//call code from here waiting for int i
}
|
|
|
|
|
The delegate you are mentioned here is one that comes with the .Net framework i.e "EventHandler" it was defined like
public delegate void EventHandler(object sender, EventArgs e); inside one of the Framework class. likewise we can also define our own delegates that suits to our need. here instead of using the native handler I defined a custom delegate to fire an event. Read the following articles which explains more about events and delegates. Events-and-Delegates-Simplified and Step-by-Step-Event-handling-in-C#
Jibesh V P
|
|
|
|
|
Ok I will try to explain with your class name
define a event in your interface iCR.cs
public delegate void ProgressChangeHandler(int progress);
interface CRInterface
{
event ProgressChangeHandler ProgressChanged;
int ProcessTWriting(ref byte[] WDat, ref int pb_value)
}
Implement this interface in CRD.cs class
class MyCR: CRInterface
{
public event ProgressChangeHandler ProgressChanged;
public int ProcessTWriting(ref byte[] WDat, ref int pb_value)
{
status = AttemptWrites(ref pb_value);
}
private int AttemptWrites(ref int pb_value)
{
for (int i = 0; i < ((wDat.Length) / 4); i++)
{
RaiseProgressChange(i);
}
}
private void RaiseProgressChange(int progress)
{
if(ProgressChanged!= null)
{
ProgressChanged(progress);
}
}
}
Finally Subscribe for event change in your FormClass i.e PC.cs
private FormLoad(...)
{
cr.ProgressChanged += new ProgressChangeHandler(CR_ProgressChanged);
}
private void CR_ProgressChanged(int progress)
{
progressBar.Value = progress;
}
Hope this helps.
Jibesh V P
|
|
|
|
|
Thanks for the extra info, Jibesh. It's not often I have to deal with events. When I tried to do the above in my CR5.cs (implements iCR),
public event ProgressChangeHandler ProgressChanged;
it says "The type or namespace name 'ProgressChangeHandler' could not be found (are you missing a using directive or an assembly reference?)"
and also, iCR
public delegate void ProgressChangeHandler(int progress);
I get "'ProgressChangeHandler': interfaces cannot declare types"
Maybe it's not going to work with an interface between PC.cs and CR5.cs (implements iCR)?
|
|
|
|