|
As I already said, look to XPath.
If you load your XML into an XmlDocument, you can get the desired contact by doing:
xmlDoc.SelectSingleNode("/Contacts/Contact[@ID='xxxxxxxxx']");
Then, you have a reference to the node into which you can add subnodes.
|
|
|
|
|
Hi,
I am fairly new to programming and I am making member registration apllication.
The main form contains a DataGridView with all the checked in members. The DataGridView connects to a
stored procedure. This main form is also the start-up form.
In the search results form I can check in / out a member. This done by clicking a button that calls a stored procedure.
Now for my question:
After I click the checkin / out button I want to update the DataGridView in the main form.
I don't seem to be able to make this work.
Below is the code that I use.
The following method is placed on the main form. This is the method I want to call from the other form.
public void FillDataGrid()
{
this.aLL_CHECKED_IN_MEMBERTableAdapter.Fill(this.on_target_v1DataSet.ALL_CHECKED_IN_MEMBER);
}
I want to call this method through the following code, this code is located on a different form:
public void btnCheckIn_Click(object sender, EventArgs e)
{
Procedures.CallStoredProcedure.CHECK_IN_MEMBER(this.lblNumber.Text);
CheckInOut(this.lblNumber.Text);
frmMain cls = new frmMain();
cls.FillDataGrid();
}
Does anyboady have any ideas how I can tackle this?
Regards,
Paul Stol
|
|
|
|
|
|
Using events as mentioned above. See this tip[^] and this article[^].Dave
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi to all! I'm having the following problem and I would like some help on trying to solve it.
I'm trying to correct a problem I detected in a code from a project I'm working on (the code is not mine and since the person who made it is no longer in the team I have no way of knowing why this was made this way).
I've spoted a cast from double to long that doesn't seem to work out very well. The idea is to convert the double value to a long so that it can be compared between two other longs (max and minimum values in a specific scale). The code is something like this:
minValue = 56;
maxValue = 70;
value = 55.99.
if ((long) value >= minValue && (long) value <= maxValue)
{
....
}
The problem is that the cast makes value to be 55, instead of 56. Checking other alternatives, I saw Convert.ToInt64, that, for this example works. However, it does not work the way I wanted if the value is say, 70.5, in this case I'm stuck with 70, when I would like to have 71, like I saw on MSDN ("If value is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.").
Can anybody point me to the correct way of converting a double to long, without this problem with rounding the even numbers?
Thanks in advance!
|
|
|
|
|
I know it doesn't answer the question exactly as it was asked but...have you thought of reversing the conversion for comparison?
if(value >= (double)minValue && value <= (double)maxValue) "I need build Skynet. Plz send code"
|
|
|
|
|
That won't work if he does math on either of the values..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
You may have to round the number using one of the three rounding methods:
Math.Round which rounds to the nearest whole number
Math.Ceiling which rounds to the next highest whole number
Math.Floor which rounds to the next lowest whole number
Your comparison should be something like this:
if (Math.Round(value) >= minValue && Math.Round(value) <= maxValue)
{
} .45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
That doesn't make much sense to me. I'll have to guess what you intent. You not showing the declarations does not help.
If all of those variables are doubles, then compare doubles, unless your conditional block is really going to do something with (long)value . If so, it deserves to be represented by a local value and an all-long comparison is in order, that would yield:
long minValue = 56;
long maxValue = 70;
double value = 55.99.
...
long longValue=(long)value;
if (longValue >= minValue && longValue <= maxValue) {
do_something_with(longValue);
}
|
|
|
|
|
Luc Pattyn wrote: That doesn't make much sense to me.
Just pray it's not the code that's calculating your credit card bill. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
...that'd be an easy calculation. 0 "I need build Skynet. Plz send code"
|
|
|
|
|
I'll make sure my expenses stay outside the [55, 71] range. And I'll double check.
|
|
|
|
|
Why would you want to round up from 55.99 to 56? 55.99 is not greater than or equal to 56. I'd say rounding down is the correct behavior there. However, for maxValue, then you might want to use Math.Ceiling to round up (well, since Math.Ceiling returns a double, you'd round up then cast to a long if you really want a long for some reason). The alternative would be to not round at all and the comparison will work fine (the longs will be promoted to doubles when you do the comparison.
My guess is somebody did the rounding because they didn't think it through very well. But there may be some perfectly valid reason that would be easier to determine if we know what code was replaced by "....".
Side note: this could possibly have something to do with setting pixel values. That is a common place for integers to be required for comparisons and such when the underlying values are really floating point numbers (e.g., doubles).
Fenryl wrote: value = 55.99.
FYI, I assume that "." is supposed to be ";".
|
|
|
|
|
What about adding .5 to 55.99 before truncating it?
|
|
|
|
|
Hi guys/gals. ...I'll cut to the chase.
I'm working with a 2.0 GridView bound to a list of my own custom data object...i.e.:
grid.DataSource = List<Record>;
Among other data, Record has a StatusMessage property that needs to display in one of the columns and it is optionally very long. I want to maintain consistent row sizes, so I am trying to use an ItemTemplate to have the TableCell contain a label with a substring of the StatusMessage plus an optionally visible "ellipsis button" if the length of the StatusMessage is longer than the set-length substring.
(Basically, if the message is "foo", I want to display "foo" and nothing else. If the message is "foofoofoofoofoofoofoofoofoofoofoofoofoo" I want to display "foofoo [...]"
...I'm trying to find an event when the GridView is created where I have access to the controls within the TemplateField (should be 2: {asp:Label, asp:Button}) and the collection never has any contents. (examples of my attempts)
protected void grdOutput_RowCommand(object sender, GridViewCommandEventArgs e)
{
int _selectedIndex = int.Parse(e.CommandArgument.ToString());
grdOutput.Rows[_selectedIndex].BackColor = System.Drawing.Color.CornflowerBlue;
Record record = ((List<Record>)grdOutput.DataSource)[_selectedIndex];
grdErrors.DataSource = GetNotificationErrors(record.NotificationID);
grdErrors.DataBind();
}
protected void grdOutput_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton _rowClickButton = (LinkButton)e.Row.Cells[3].Controls[0];
string _script = ClientScript.GetPostBackClientHyperlink(_rowClickButton, "");
e.Row.Attributes["onclick"] = _script;
e.Row.Cells[2].CssClass = "expandoButton";
e.Row.Cells[2].Controls[1].Visible = true;
}
}
protected void grdOutput_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Record record = (Record)e.Row.DataItem;
if (record != null)
{
TableCell cell = e.Row.Cells[2];
cell.Text = record.StatusMessage;
cell.Controls[1].Visible = true;
if (record.StatusMessage.Length > 50)
{
cell.Text = record.StatusMessage.Substring(0, 50);
}
cell.CssClass = "expandoButton";
cell.BackColor = System.Drawing.Color.Orange;
}
}
}
protected void grdOutput_PreRender(object sender, EventArgs e)
{
GridView output = (GridView)sender;
foreach (GridViewRow row in output.Rows)
{
row.Cells[2].Controls[1].Visible = false;
if (row.Cells[2].Text.Length > 50)
{
row.Cells[2].Text = ((Record)row.DataItem).StatusMessage.Substring(0, 50);
row.Cells[2].Controls[1].Visible = true;
}
}
}<div class="signature"><div class="modified">modified on Thursday, March 18, 2010 2:25 PM</div></div>
|
|
|
|
|
ok...weirdness that I wasn't aware of (related to my original post)
in grdOutput_DataBound event, if I pull the cells out of a GridViewRow, the cells that display text from BoundColumns have been populated, but the TemplateColumn that I have included (that has my StatusMessage data in it) has text=String.Empty. Anyone have any idea which server event it is that the TemplateColumn cells will actually have text?"I need build Skynet. Plz send code"
|
|
|
|
|
I have another strange issue. I deployed my project with "available online ony" and it works fine for everyone except for one particular user. This user is on a college campus and is apparently using http proxy.
Is there a specific port used when executing or something I need to be aware of to help troubleshoot this issue more? It is only for one user. It works fine for everyone else.
Here is the log:
The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [ProcessorArchitecture] = Intel {string}
Property: [VersionNT] = 5.1.3 {version}
Running checks for package 'Windows Installer 3.1', phase BuildList
The following properties have been set for package 'Windows Installer 3.1':
Running checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '3.1': true
Result of checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe' is 'Bypass'
'Windows Installer 3.1' RunCheck result: No Install Needed
Running checks for package '.NET Framework 3.5 SP1', phase BuildList
Reading value 'SP' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5'
Read integer value 1
Setting value '1 {int}' for property 'DotNet35SP'
The following properties have been set for package '.NET Framework 3.5 SP1':
Property: [DotNet35SP] = 1 {int}
Running checks for command 'DotNetFX35SP1\dotNetFx35setup.exe'
Result of running operator 'ValueGreaterThanEqualTo' on property 'DotNet35SP' and value '1': true
Result of checks for command 'DotNetFX35SP1\dotNetFx35setup.exe' is 'Bypass'
'.NET Framework 3.5 SP1' RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with HRESULT '-2146697211'
|
|
|
|
|
Hi,
In my project i need to convert the lat/long values to MILS. MILS means milliradians. and lat/long means it have degree values. so,
1MILS=0.0573degrees.
But in the lat/long values, i will have degree, minutes,seconds and direction. So, what are the things that i should consider and calculation to be performed during the conversion? Can somebody help me????
|
|
|
|
|
Ummm... aren't there sixty minutes per degree and sixty seconds per minute?
You didn't like the answer you got before[^]?
|
|
|
|
|
yes.
yes.
no.
|
|
|
|
|
You need to calculate the total degrees first:
Basically:
D = d + m/60 + s/360
Where
D = full degrees,
d = degree of your co-ordinate.
m = minutes of your co-ordinate.
s = second of your co-ordinate.
The to convert to radians:
r = (PI * D) / 180.
The miliradians is r * 1000.
The main things you are likely to run up against are:
1. Precision errors in the maths. You can re-work the formulae I have given you to help.
2. The problem that the Earth isn't a true sphere, it is flattened at the poles. Calculating distances on a non-true sphere is beyond my capabilities at the moment....Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Now you tell you want milliradians. I thought you want to use Miles as in distance.
For 1 Degrees, it comes about "17.452" MILS. To convert Degres, Minutes and seconds use the folowing code:
Double dec = degres + (minutes/60) + (seconds/3600)
Double mils = dec * 17,452
|
|
|
|
|
See http://en.wikipedia.org/wiki/Angular_mil[^]
You need some more information before you can convert. Which definition of mil do you want to use?
Decide which unit definition you really want and apply the appropriate formula. You can convert seconds to degrees by dividing by 3600 and minutes to degrees by dividing by 60.
[Edit] Corrected URL [/Edit]CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
modified on Thursday, March 18, 2010 2:23 PM
|
|
|
|
|
right. see also here[^].
1 circle = 6400 mils.
|
|
|
|
|
Actually it's not quite so simple:
- 1⁄6400 of a circle in NATO countries.
- 1⁄6283 The “real” trigonometric unit of angular measurement of a circle in use by telescopic sight manufacturers.
- 1⁄6000 of a circle in the former Soviet Union and Finland.
- 1⁄6300 of a circle in Sweden.
Aren't standards fun? CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|