|
Take a look at int.TryParse() and int.Parse();
Just because we can; does not mean we should.
|
|
|
|
|
Shan85 wrote: u said that x is not an integer,.. But i want to use this node value as an integer in my next part of my program.. is t possib?
You posted an XPath statement, we can't tell from that what your XML looks like. If you don't post a XML fragment with this 'X' node containing an integer value, we can't give you a specific code example for it. In my previous reply I posted an XML fragment to go with the code that obtains the value from it.
led mike
|
|
|
|
|
i got it Mike...Thanks..
Pls clear my next doubt..
I have retrieved the value from an XML file...
wen a button is clicked.. a new form opens with a text box..
i want the value of the XML node to be displayed in the text box...
say..CropX is the integer.. tbX is the name of the text box..
How can i do that.. When the form,is initialised, the text box should be initiated with the cropX value..
pls help me lik previous time Mike..Awaiting for ur reply
|
|
|
|
|
XmlNode node = doc.SelectSingleNode("//Image/Crop/X");
myTextBox.Text = node.InnerText;
led mike
|
|
|
|
|
Thank u Mike..
Got the answer yesterday itself..
But forgot to reply you..sorry..
And a big thanks..
|
|
|
|
|
Hi All,
I have a from with a textbox and a button. when the user clicks on the button, the value of the textbox wil save into sql server database table that has a column 'Varchar' type. bud if the text in the textbox has a 'sinqle quote', im getting a sql error.
How can i solve this issue?
Thanx.
|
|
|
|
|
|
try replacing single quote with two singlequotes:
TextBox1.Text.Replace("'","''")
but give a look at SQL Injections before
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
With a question mark
Comamnd Text = "SELECT * FROM someTable where someValue = @someValue"
Then add a parameter to the command object. It works surprisingly well, although I still prefer stored procedures.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Yes, stored procs are the way to go, and then still use parameters in the Command object. This will prevent most types of SQL injection attacks, although second-level attacks may still work. It will allow you to have single quote marks in the parameter values.
|
|
|
|
|
Hi,
I want my user's to share their shopping cart.For example, if a user want he can copy his shopping cart link to his friend and his friend can buy the same products.
Any idea will be helpfull.
Thanks
|
|
|
|
|
And where exactly are you stuck?
|
|
|
|
|
Question is way too general. I can think of 20 ways to do that right off the top of my head, but only one of them is going to work for you.
This is a programming questions forum. Your question is not a question that can be fixed with code. You need an architecture solution. This is not something that anyone can help you with. Ultimately, you are going to have to design this system yourself.
When you get to the point where you have some code written and something is not working right and you've spent at least 3 hours trying to fix it yourself, then you can post a question, and be sure to include sample code, requirements, and a description of the things you tried that didn't work, so we don't go trying the same things again.
|
|
|
|
|
Hello everyone,
I am trying to do some printing. I have a custom richtextbox and a datagrid I am printing, but I am having some positioning issues. My custom richtextbox makes use of the Microsoft code recommended for printing rich text boxes(http://support.microsoft.com/kb/812425). My problem is that I have a datagrid with some information that I would like to print following the richtextbox and I am having a problem determining the current y position on the page once I am finished printing the richtextbox. Does anyone have any suggestions on how I can go about this?????? Please help??????
Thanks,
Kendal
|
|
|
|
|
Nevermind, found out how to do it. Thanks anyway!
|
|
|
|
|
Hi
I've got an C# .NET 2 app that uses toolstrips with 3d look. When you start the app, a splashscreen appears and then after 30 or so seconds, the main screen appears.
If you CTL/ALT/DEL lock the machine during the startup, when you unlock, the toolstrips have lost their 3d style and appear 'flat'.
Anyone seen this before/know of a resolution?
Thanks in advance
Rob
|
|
|
|
|
RobMaddison wrote: 30 or so seconds
Man... that's a lifetime!
RobMaddison wrote: toolstrips have lost their 3d style
Is the the 3D styling a custom job (i.e. bitmaps/jpegs et al)? Have you tried setting a breakpoint on the render method (I can't remember the event, I know there's an OnPaint somwehere or something)?
My apologies - I don't do much front end stuff.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton
|
|
|
|
|
Dave Sexton wrote: Man... that's a lifetime!
Tell me about it! It's a fairly major app though that loads a lot of initial data and runs throughout the day, so I guess it's not too bad.
Dave Sexton wrote: Is the the 3D styling a custom job (i.e. bitmaps/jpegs et al)? Have you tried setting a breakpoint on the render method (I can't remember the event, I know there's an OnPaint somwehere or something)?
There's no custom 3d styling, it's just literally Office-style toolstrips with the vertical gradient (light gray - slightly darker light gray). It's a bit difficult to add breakpoints because the issue requires me to lock the machine.
To recreate, you can create very simple app with a .Net Office 2003-style toolstrip, put a delay on the app before showing the form, start the app, lock the machine, unlock it when sufficient time has passed - the toolstrips will lose their gradient.
Strangely, i've never seen this before outside our app, but when I opened my machine this morning, Microsoft Outlook had lost its toolstrip style in exactly the same way!
Thanks for the response by the way.
|
|
|
|
|
RobMaddison wrote: To recreate, you can create very simple app with a .Net Office 2003-style toolstrip, put a delay on the app before showing the form, start the app, lock the machine, unlock it when sufficient time has passed - the toolstrips will lose their gradient.
Hmmm.... have you tried installing this app on a machine other than your dev machine?
Does the machine have good specs?
I can't really recreate the sample app as I'm at work at the moment.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton
|
|
|
|
|
Yes, it's installed on 30+ different machines.
The spec of my machine is pretty high. I have a feeling it's either a Windows or .Net issue.
Cheers
|
|
|
|
|
I followed a simple tutorial from microsoft to use a simple function puts in msrcrtdll.dll. I created a console application (C#) and copied the code as it is given. The program runs fine but dees not print as it is supposed to do. I am using VS2008. Please help. Here is the code
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
<br />
class PlatformInvokeTest<br />
{<br />
[DllImport("msvcrt.dll")]<br />
public static extern int puts(string c);<br />
[DllImport("msvcrt.dll")]<br />
internal static extern int _flushall();<br />
<br />
public static void Main() <br />
{<br />
puts("Test");<br />
_flushall();<br />
}<br />
}<br />
<br />
http://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx#pinvoke_example1[^]
|
|
|
|
|
Stick a Console.Read() after the call to _flushall(); and then run the exe directly from the debug or bin folder.
Not sure why it doesn't appear in the VS console window, though - possibly because it isn't the stdout target?
modified on Monday, May 12, 2008 1:31 PM
|
|
|
|
|
Thank you so much. It worked by directly running the .exe file. Also i created a simple DLL which implements a sum function. When i implement it in C#, it says it can not load the dll. I copied the DLL to the current folder. I do not know why it is not loading the DLL. Do you know why?
Thanks again
|
|
|
|
|
I'm sorry, I don't - if the usual rules of dll's is being followed it would need to be in the release/debug folder or in the System directory, but this goes beyond my experience with P/Invoke.
|
|
|
|
|
The problem was with my 64 bit windows (Vista). I have a couple of issue with it and this is one of them. The code runs fine on another machine (32 bit vista). Thanks for the help though.
|
|
|
|