|
sir can we take the field as nvarchar to store xml?
|
|
|
|
|
Not sure what that means.
Can you store an entire xml document as text in a single column in a database? Then yes.
However the poster is attempting to process and parse the xml and store the parsed result, not xml, in the database.
|
|
|
|
|
Can someone please help a newbie with what I suspect is a simple error?
Program.cs:
using System.IO;
namespace CreateDT
{
static class Program
{
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
static void MyMethod (name1 string, name2 string)
{
}
}
}
Form1.cs:
using System;
namespace CreateDT
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void DoItButton_Click(object sender, EventArgs e)
{
MyMethod(currentfile, TargetFile);
}
Gives error "CS0103 The name 'MyMethod' does not exist in the current context." I've looked at lots of examples which all seem to be done this way. Obviously not, what am I missing?
|
|
|
|
|
The method 'MyMethod' is inside (= a member of) the (static) class 'Program', so you have to use
Program.MyMethod(currentfile, TargetFile);
|
|
|
|
|
Methods (and fields, properties and events) are part of the class definition: So when you add a method to ClassA, it doesn't exist as part of ClassB. So to access a ClassA method from ClassB, you have to specify which class you are referring to; which class the system should look at - either by specifying a class instance:
Button b = new Button();
b.Text = "Click me!"; Or (in the case of static methods like MyMethod) by specifying the class name:
Program.MyMethod(currentfile, TargetFile);
But you shouldn't really be modifying the Program.cs file - instead add a Utilities.cs file, and create a static class in that. To DO that, right click your project name in the Solution Explorer pane, and select "Add"..."Class...". Change the name from "Class1" to "Utilities" and click the "Add" button.
Change the class to static and add your method to that. Then when you write your code, it's a bit more obvious that these are designed as "generic helper" methods:
Utilities.MyMethod(currentfile, TargetFile);
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.
modified 21-Jan-18 15:05pm.
|
|
|
|
|
They are both private methods of class OrdersContyrolAccessibleObject .
|
|
|
|
|
I try private too I have the same problem.
DB
|
|
|
|
|
It is a simple spelling mistake on your class name.
|
|
|
|
|
What you think it's wrong spelling.
BUY == Buy;
SELL == Sell;
or
rBBUY == rbBuy;
I changed in Windows Form Properties
I have the same Error Buy and Sell
David
|
|
|
|
|
David, your class name is spelled incorrectly. You named your class
OrdersContyrolAccessibleObject . Note the extra y in Control.
This space for rent
|
|
|
|
|
Yes, Was extra y there , but I have the same problem.
I change it from private to public, do not work.
I don't know what can I do next to work.
David
|
|
|
|
|
Show us exactly what you have as your code now.
This space for rent
|
|
|
|
|
First, apologies if this is a common question, I've done a few searches to no avail but honestly I'm not 100% sure how to search for what I want.
I would like to create a project (Project X), probably just a DLL, that can be used as a reference for multiple other projects. Project X is installable, and Project A and Project B can reference it. I want to be able to make updates to Project X, without having to reinstall A and B.
Example: A and B referece v1.0 of X. Project C comes along, and needs a few added classes, etc. that would make sense to have in a global project like X. So X becomes 1.1, and Project C uses that new code. Project A and Project B continue to work without requiring an update.
A real world example: A vendor that my employer uses has five or six applications for various tasks, they all need to communicate either with each other or with our mainframe. The vendor has a "Security" app that has all of the code for these connections. Occassionally, if we get a new application or update an existing application, we have to update the Security app to a new version, but this doesn't require us to update every one of that vendor's applications that rely on said security app. I want to mimick that and I'm drawing a blank.
|
|
|
|
|
So do. What is stopping you?
I do it all the time: A solution of projects which produce DLL Assemblies (either with a single test EXE project or individual test EXE projects as necessary).
Other projects producing EXEs reference either the Release build Assembly, or the project that generated it (depending on whether I need to step into the DLL assembly for debugging purposes or not).
Change the DLL, rebuild it, overwrite / reregister it, and the existing EXE projects use the new version without needing any recompilation.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Sounds like you need a DLL, or a COM library. In both cases you can manage future enhancements with new versions without affecting existing clients. Google, or the CodeProject Articles section[^] should have some whitepapers and samples.
|
|
|
|
|
I have a base class that sets property values:
<pre>public void SetProperty<T>(string propertyName, ref T propertyField, T value)
{
if (!Object.Equals(value, propertyField))
{
if (OnPropertyChanging(propertyName, propertyField, value))
{
IsDirty = true;
T oldValue = propertyField;
propertyField = value;
RaisePropertyChanged(propertyName);
OnPropertyChanged(propertyName, oldValue, propertyField);
}
}
}
I then call it like this:
<pre>private string _CompanyName;
public string CompanyName
{
get { return _CompanyName; }
set
{
if (_CompanyName != value)
{
SetProperty<string>("CompanyName", ref _CompanyName, value);
}
}
}
Yet for a nullable property I get a compilation error.
private decimal? _GLRate;
public decimal? GLRate
{
get { return _GLRate; }
set
{
SetProperty<decimal>("GLRate", ref _GLRate, value);
}
}
Cannot convert from ref decimal? to ref decimal
I'm guessing it doesn't work with generics??
How can I make this work?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
"decimal" is not the same type as "decimal?" even though they have a lot of characters in common ("?" is what the call syntactic sugar, Visual Studio converts decimal? into a type that looks nothing like "decimal")
So update the type in the angle brackets to reflect the actual type
SetProperty<decimal?>("GLRate", ref _GLRate, value);
However you can actually do without the brackets altogether, .net can work the type out from the params you supply
SetProperty("GLRate", ref _GLRate, value);
|
|
|
|
|
Removed the <types>.. Works great! Thank you!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
On a side note, if you use "nameof", you can get rid of your string "values" in this case and use the compiler for insuring valid names.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi,
I have an existing application in which i have to add/update around 5000 rows * 50 Columns at a time within One Minute.
On each row update i have to do following two things :
> update two columns back color upon condition.
> Play Sound (like new row added, row updated etc) upon condition.
I have tested ComponentOne FlexGrid and DevExpress Grids so far. Both are good but when i send 100,000 orders, they keep jerking/freezing for few milliseconds.
Is there any best gridview exist inspite of that two grids ??
Thanks in advance.
|
|
|
|
|
There isn't a grid in existence that will keep up with that kind of demand.
The problem isn't the grid. It's how you're using it.
The grid can only show probably 100 rows, so why are you updating grid rows that can't be shown? You don't update the data in the grid at all. You update the data source the grid is bound to.
|
|
|
|
|
Good evening, I followed the steps that you made on how t make a Remote Desktop Using C#.Net. But I can't connect to the computer that I wanted to control. Also, will I use the username and password of the current user account that is logged in to the username and password in your tutorial?
|
|
|
|