|
This looks like you are getting the Column Value with GetColumnValue call. Not sure what Columns.IsRequired is, another property? My guess is that it comes from the table data. If that is correct then you are trying to set data in the table column with your setter.
Your problem seems to be that Columns.IsRequired is set to read only, not your IsRequired property.
The only way that I know of to set a class property read only is to not give it a setter.
|
|
|
|
|
or maybe also make the setter private
|
|
|
|
|
I am trying to develop a tool which will add a host into the DNS server calling dnscmd.exe. I am assigning the property FileName as "dnscmd.exe" and pass the required i/p parameters. I did call nslookup.exe same way as I have called dnscmd.exe but in case of nslookup.exe code is working properly but in case of dnscmd.exe it's throwing exception while starting the process (here p.Start()) with message as "The system cannot find the file specified" .I am sharing the code snippet in top.
I have uncomment the WorkingDirectory and FileName (with fully qualified path of dnscmd) but still got the the same error. Someone please reply on my post and provide the resolution as I'll implement it ASAP. Thanks in advance
Public bool AddtoDns(IStore iStr)
{
#region "Comment for Testing"
bool isAdded = true;
string strTid = "T00000013";
string strDnsServerName= "OD-EV-W-DC-5.7-11T.COM";
string strZoneName= "7-11t.com";
string strIP= "10.172.13.10"
System.Diagnostics.Process p = new System.Diagnostics.Process();
try
{
if (!CheckDnsEntry(iStr))
{
p.StartInfo.FileName = "dnscmd.exe";
p.StartInfo.Arguments = strDnsServerName + " " + "/RecordAdd" + " " + strZoneName + " " + strTid + " " + "A" + " " + strIP;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
isAdded = true;
}
else
{
isAdded = false;
}
return isAdded;
}
catch (Exception ex)
{
throw ex;
}
finally
{
p.Dispose();
}
#endregion
}
|
|
|
|
|
The most obvious thing to check is: "is 'dnscmd' installed, available, and on the system path?"
For example: if you run up a command box and type "dnscmd" into it, does it run? It doesn't on my computer...
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
yes dnscmd.exe installed in my computer under c:\windows\system32 (OS-Windows7). Now I am just trying to execute dns command using the below code-
private void button3_Click(object sender, EventArgs e)
{
Process.Start("C:\\Windows\\System32\\cmd.exe", "/K \"dnscmd\"");
}
The above single line code works fine when we replace dnscmd to nslookup,ipconfig etc but when I am trying to run the single line code with dnscmd it opens a cmd window and showing "not recognized as an internal or external command" message but if I open a cmd window from run (not from c# programe) in the same computer (working fine from all directory) then dnscmd works fine and able to add dns entry also.
So, is there any possibility on access issue or anything else which causing abnormal behaviour of dnscmd. Please help!!!!
Subhendu
|
|
|
|
|
The command window should stay open - so try it and then do two things:
1) type "dnscmd" and see if it runs.
2) type "path" and see if what you get looks sensible (i.e. it includes the folder dnscmd.exe is installed in)
I tried it here (with "whoami") and everything looks fine.
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
How to give C# chart height ,width based on data?
|
|
|
|
|
You own the data and you own the chart so devise a measurement metric based on the content of the data and set the chart width based on that metric.
We are not telepathic, nor can we see your data so we cannot guess what it looks like so can't devise a metric that would make sense!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
my code
int Xcount = dt.Rows.Count * 25;
List<int> levels = dt.AsEnumerable().Select(al => al.Field<int>(dt.Columns[1].ToString())).Distinct().ToList();
int yCount = levels.Max()*500;
Chart chart = new Chart();
//chart.Size = new Size(Xcount, yCount);
chart.DataSource = dt;
//chart.Width = 350;
chart.Height = Xcount;
//create serie...
Series serie1 = new Series();
serie1.Name = "Serie1";
serie1.LabelBorderWidth = 400;
serie1.Color = Color.FromArgb(255, 0, 0);
serie1.BorderColor = Color.FromArgb(164, 164, 164);
serie1.ChartType = SeriesChartType.Column;
serie1.BorderDashStyle = ChartDashStyle.Solid;
serie1.BorderWidth = 1;
serie1.ShadowColor = Color.FromArgb(128, 128, 128);
serie1.ShadowOffset = 1;
serie1.IsValueShownAsLabel = true;
serie1.XValueMember = dt.Columns[0].ToString();
serie1.YValueMembers = dt.Columns[1].ToString();
serie1.Font = new Font("Tahoma", 8.0f);
serie1.BackSecondaryColor = Color.FromArgb(0, 102, 153);
serie1.LabelForeColor = Color.FromArgb(255, 255, 255);
serie1.ChartType = SeriesChartType.StackedBar;
serie1["PixelPointWidth"] = "12";
chart.Series.Add(serie1);
//create chartareas...
ChartArea ca = new ChartArea();
ca.BorderWidth = 2;
ca.Name = "ChartArea1";
ca.BackColor = Color.White;
ca.BorderColor = Color.FromArgb(255, 0, 0);
ca.BorderWidth = 0;
ca.BorderDashStyle = ChartDashStyle.Solid;
ca.AxisX = new Axis();
ca.AxisY = new Axis();
string YAxixName = dt.Columns[1].ColumnName;
ca.AxisY.Title = YAxixName;
// Set axis title
chart.ChartAreas.Add(ca);
chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
//databind...
chart.DataBind();
series name for each series is not displaying.
|
|
|
|
|
So pick out all the bits that add to the width of a column, multiply that by the number of columns in the data, add a bit and set your with to that. Run your app and when it looks horrible try and work out what you have missed. Get the max and min of your data range and that will help define your height.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Calculate the largest value.
Assign 100 to this value.
Then assign a proportional value to the other values based on the proportion of a percentage to the highest value.
Plot your values based on this percentage.
It's quite simple when you apply your mind to it
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
|
Hi, I want to create a windows phone 7.1 app for finding the closest postcode too 4 predefined postcodes, I have found an access db that has all the uk postcodes in so i thought I would start by with a simple postcode query and work from there but I am struggling to fidd a query tutorial that will go through query a database.
could someone point me in the right direction please,
regards
Paddy
|
|
|
|
|
It will depend on the geo coding of your source data. When I did something like this in about 2002 I found the postcodes in Britain change from 1 month to the next so there was a need to subscribe to one of the geo coding sources, was very expensive at the time.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft,
thanks for the reply, I am able to get the UK list for free from the post office at present so I would like to go down the database route for this exercise as I have not worked with databases before on windows mobile, I am struggling to find a simple user input query project to help me get started.
Regards
Paddy
|
|
|
|
|
Is there a way to override SerialPort.ReadExisting() method? I'm working on the unit testing on the software that involves with Serial Port communication, using "test doubles".
Anyone can point me any suggestions? Thanks!
|
|
|
|
|
What version of Visual Studio are you using? Ultimate or Premium 2012/2013 can use a Fakes assembly which addresses specifically this with "Shims".
Fakes in Visual Studio Testing[^]
Or are you using some other kind of testing software (please specify)?
|
|
|
|
|
I am using Visual Studio premium 2010
|
|
|
|
|
... Or the other way to perform "stimulated" serial port communication?
|
|
|
|
|
An idea would be to write a simulation program which is sending dummy data to a virtual serial port at which your program is listening. You could pair those two virtual ports using com0com.
|
|
|
|
|
have a list in python like this
{Uin32} {Uin32, Uin32, String, Uin32, double}
How can i access each element in C#
I used this command
IronPython.Runtime.List pRFList = rf_model.model(ut_rx_list, ut_tx_list);
how can i walktrough this list (like foreach command)
thanks in advance
|
|
|
|
|
According to this[^], IronPython.Runtime.List implements IList<object> and IList , so a foreach loop should work.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have following requirement to develop in C#
Open command prompt i.e. invoke cmd.exe
run cd/ command
run command1
run coomand2
run command 3
run exit command
I need to save the output of the command1 , command2 and command3 in the same text file.
Please provide a sample code to execute multiple commands one by one and save output to same text file
|
|
|
|
|
superselector wrote: I have following requirement to develop in C# Basically a batch-file whose output is redirected. A batch-file is a collection of commands that are executed one after another;
DIR C:\TEST
DIR C:\TEST2
You could redirect the output when calling the batch-file, like "MYBATCH.BAT >C:\RESULT.TXT".
superselector wrote: Open command prompt i.e. invoke cmd.exe Google for "C# redirect console output" for examples.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|