|
Did you find the solution....? I am also stuck in the same problem.
dfdfd
|
|
|
|
|
I downloaded the 'Building a Data Access Layer - The Demo Application' by Damon Armstrong. I want to use the DataServiceBase class that he built in another application. I do not want to use the PersonDataService that he has in the same Namespace. To make a long story short, I copied the class that I want to a new C# Class Library. There is only one problem, it won't compile. I get the following error:
The name 'ConfigurationManager' does not exist in the current context C:\HAA_C_Library\DataServiceBase\DataServiceBase.cs
Here is the method that causes the error:
protected static string GetConnectionString()
{
return ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
}
I have the following before the start of the class:
using System.Configuration;
When I go to the Object Browser, it shows ConfigurationManager as a class within System.Configuration. Yet, when I try to use it; it is not there. When I go to the original code that I downloaded, it behaves as desired.
What is happening here? I've looked at everything I know to look at and can't see any difference between the original code and mine. But one works and one doesn't.
Thanks in advance,
Mary
|
|
|
|
|
Well, after trying almost everything. I got it to work. I added System.Configuration to the References section. Now all is fine. Evidently, it was not using the correct library.
|
|
|
|
|
No, you were using the correct library you just hadn't told the compiler to link it in, so although it was importing the System.Configuration namespace it couldn't actually find it.
|
|
|
|
|
i wanna to know how can i generate an algorithm by using DNA computing to solve A/B problem? is it NP complete?
SUMA
|
|
|
|
|
bool isA = false;
bool isB = false;
foreach (chromosome c in theCell)
foreach (gene g in c)
{
if (g == KnownGenes.BloodTypes.A)
isA = true;
if (g == KnownGenes.BloodTypes.B)
isB = true;
}
if (isA && isB)
printf("type AB");
else if (isA)
printf("type A");
else if ( isB)
printf("type B");
else printf("type O");
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
thanks alot for reply, is there a way to proof that a\b is a NP complete or not?? using hamitolian path for example?is their such algorithm for that??
SUMA
|
|
|
|
|
|
i didnt mean that,, i wanna to know if there any resources of what i need couse i searched but i didnt find any good result, & if u familiar of these kind of problem u know that it is just the first step
thx
SUMA
|
|
|
|
|
Harta hr = this.ParentForm;
hr.OnPaint1();
this code raises the folowing error
Error 1 Cannot implicitly convert type 'System.Windows.Forms.Form' to 'THE_PROJECT.Harta'. An explicit conversion exists (are you missing a cast?) C:\Documents and Settings\Razvan\My Documents\Visual Studio 2005\Projects\THE PROJECT v2\THE PROJECT v2\Elemente.cs 48 23 THE PROJECT v2
i knew it was imposible for that to work but i need to call that method from the child form. Can somebody help me?
rzvme
|
|
|
|
|
Harta hr = this.ParentForm as Harta;<br />
if (hr != null) hr.OnPaint1();
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The method that Pete mentions is valid. However, I would suggest you look at having the child form raise an event that the parent form subscribes to.
public class MainForm : Form<br />
{<br />
public void CreateChild()<br />
{<br />
ChildForm cForm = new ChildForm();<br />
cForm.ParentForm = this;<br />
cForm.MyOnPaint += new EventHandler(OnPaint1);<br />
<br />
cForm.Show(); <br />
}<br />
<br />
protected override void OnPaint1(object sender, EventArgs e)<br />
{<br />
}<br />
}<br />
<br />
public class ChildForm : Form<br />
{<br />
public event EventHandler MyEvent;<br />
<br />
protected override void OnMyEvent(object sender, EventArgs e)<br />
{<br />
if (MyEvent != null)<br />
MyEvent(sender, e);<br />
}<br />
}
Please forgive any typos as I wrote the above code on-the-fly. So, in the child form when something happens that you want to communicate back the event you just call OnMyEvent from within the ChildForm. The nice thing about this is that it promotes loose coupling, because the ChildForm doesn't know if it's parent is MainForm or SomeOtherForm. You can take it a step further by making the event part of an interface that ChildForm implements. In that way you decouple the child from the parent as well.
|
|
|
|
|
How can you find a datareader is open or closed ?
|
|
|
|
|
Have you checked IsClosed()?
|
|
|
|
|
Hi..
This is Vijay..I started learning .NET recently and I have a module in c#.NET, which should call the file(c:\data.txt)which is in binary format and the data should be updated in the database according to the notepad file...Plz someone help me retrieving the data from notepad char by char and differentiating between the delimiter..
Thanks
Vijay Mesa
|
|
|
|
|
Are you trying to read the file in character by character?
|
|
|
|
|
Hi everyone!
Please help me with following questions:
1- How can we add nodes in treeView using following context menu:
Before Node (at same Level)
After Node (at same Level)
Child Node
2- How can we disable particular contextMenuItem? For example if root node is selected "Before Node" will be disable. Where should I put "meuItem.enable = fasle;" line in the code. I have used "treeView_AfterSelect" event for disabling but it doesn't work fine with right click.
Please guide me by an example and please tell me if any sample on code project regarding treeView.
Thank You.
|
|
|
|
|
Go add a new TreeNode at the same level as a given TreeNode you will need to look at the current TreeNode's parent and add your new node to the parents Nodes collection using the Insert method of the TreeNodeCollection.
A rough example (not tested):
.
.
.
int currentIndex = CurrentTreeNode.Parent.Nodes.IndexOf(CurrentTreeNode);
.
.
.
CurrentTreeNode.Parent.Nodes.Insert(NewNode,currentIndex);
.
.
.
CurrentTreeNode.Parent.Nodes.Insert(NewNode,currentIndex+1);
.
.
.
Note that you should check that the current node isn't the root (parent == null).
To add a child you simply add a new node to the current node using CurrentTreeNode.Add(NewNode)
To disable the menu items you might want to do it on the context menus Popup event.
|
|
|
|
|
How can I set the currentTreeNode equal to Selected Node.
I want to add before and after the selected node.
Thank you.
|
|
|
|
|
You need to hook in to the AfterSelect event and then test the value of e.Node.Level to determine what level in the tree control the selected node is located. Based on this value you can enable/disable different menu items. To do this with mouse clicks, you need to hook in to the NodeMouseClick event. You can test using something like e.Node.IsSelected && e.Button == MouseButtons.Right
In your event handlers, you will need to use the value of e.Node to determine which node you need to interact with to add the new TreeNode object.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi
I can develop a project in multilanguage in C# but i am unable to convert it in VB.net. Any one ready for assistance...................
Regards
Syed Shahid Hussain
|
|
|
|
|
Hi,
I know that to convert an int to a string you use:
myInt.toString();
But, I want to convert a string to int, what is the function for this?
Thanks.
|
|
|
|
|
In .NET 2.0 use Int32.TryParse , otherwise Int32.Parse .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks mate, a great help
|
|
|
|
|
There is also a method like
Convert(variable,CType)
Good Luck
Syed Shahid Hussain
|
|
|
|