|
alrsds wrote: to be fair, I think forms more frequent in real world examples
Sure, forms are used a lot. Full English sentences are used more often that phrases like 'see spot run', but that doesn't mean that a 6 year old starts to learn to read by reading Shakespeare.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Well, you need VS to write apps.
::cough:: No you don't. ::cough::
|
|
|
|
|
:: :: Don't you need it? :: ::
and why?
|
|
|
|
|
alrsds wrote: Don't you need it?
and why?
Visual Studio is merely an integrated tool that allows you to edit and compile a program without having to learn the individual commands. However, you can create a source file from any editor and compile it with the csc command.
But, using VS makes it much easier.
|
|
|
|
|
public static bool UpdateVisitor(string id,string n, string c, decimal p)
{
drow = ds.Tables[0].Rows.Add();
drow[0] = id;
drow[1] = n;
drow[2] = c;
drow[3] = p;
vda.UpdateCommand = vcb.GetUpdateCommand();
int res = vda.Update(ds.Tables[0]);
if (res > 0)
{
System.Windows.Forms.MessageBox.Show("Visitor Details Updated");
return true;
}
else
return false;
}
i am new. pls tell me what is wrong. i want to update the data ok.......... thanks in advance
modified on Friday, September 25, 2009 1:27 AM
|
|
|
|
|
New to the site, or new to C# ? If you're new to C#, then why are you writing this code ? I assume you're writing for learning purposes, there is no way you're writing production quality code. So, choose a simpler task, and learn your way up to what ever task it is you're trying to learn how to do. And, when you ask questions, don't say 'what is wrong'. Tell us what you want the code to do, what it does instead, what your efforts at debugging have told you already, etc.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Are u getting any error or what? Whats ur problem?
I hav few more Qs.
1) Where r u defining ur dataset "ds"?
2) Why u want ur return type Static?
|
|
|
|
|
I love it when they ask dumb questions, and when you try to help, they never answer.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Its their loss.
|
|
|
|
|
He asked the same question a couple of days ago. I can't remember, nor can I be bothered to check, if he got an answer then.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
is it possible to add many panels to a form dynamically?
one panel contains 4 or 5 controls like txtbox and button.
if anybody has an idea, thanks in advance.
rgds,
|
|
|
|
|
Yes, how else would they get there?
this.Controls.Add ( whatever ) ;
|
|
|
|
|
Hi, all,
I am implementing an IE toolbar with buttons to control the flash object. I have toolbar worked but failed to control the flash player in the current IE. Basically the toolbar buttons control the flash movie to play, pause, move to begin and end. It would greatly appreciated if you give the idea on how to make them work.
IHtmlElement element = FindFlashElement();
try {
// The following line failed with InvalidCastException
ShockwaveFlashClass flashclass = (ShockwaveFlashClass)element;
} catch (InvalidCastException ex) {
// failed to cast to ShockwaveFlashClass
}
IShockwaveFlash flash = (IShockwaveFlash)element;
flash.Play(); // nothing happens, same to Stop(), StopPlay(), etc.
1. I am using the latest flash plugin at c:\windows\system32\Macrodev\flash\flash10c.ocx.
2. There are two interfaces in the OCX: IShockwaveFlash and ShockwaveClass. They have pretty much the same methods. What's their different usage?
3. How to get the length of the current movie played? The IShockwaveFlash.TotalFrame always returns 1.
4. Please let me know where would be the best place to get such answers if you happen to know.
5. Is there any way to play the movie from certain place, such as from 1 minute 52 seconds? And how to know the current playing time?
Than you again for your help.
|
|
|
|
|
I have created a time picker as a form in a project, Could anyone please help me in how to create this as a control like for eaxample the open file dialogue, i have tried but keep hitting all sorts of "using" issues when i create it as a dll. I have a lot of experience of c# forms programming but out of that i need some direction
Any help or pointer to forum posts would be gratefully recieved
thanks
Duncan
|
|
|
|
|
I'm sorry, I don't get the question. What sort of issues do you get ? I suspect if you want to put it in a dll, a dll does not have the windows forms stuff in it by default, so you need to add a reference to that dll, and then it will work.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i have never created a custom control before but think if i can get this to work it would be a good one for other projects i work on. i have it as a standard windows form at the minute and want to port it to a control. Whatever i have tried has failed and i am looking for help on a how to create it as a component so in the future i can add it like an open file dialogue.
Duncan
|
|
|
|
|
OK, so there's several steps here.
1 - make your form a control. This is really easy, just create a blank control and move your form to it.
2 - put it in a dll. The only issue I see here, is making sure you import the Windows.Forms dll so you have that stuff inside the scope of your code
3 - make it appear in the designer. Not sure if this just happens or if you need to add some sort of attribute to make it happen
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: 3 - make it appear in the designer. Not sure if this just happens or if you need to add some sort of attribute to make it happen
You mean add it to the Toolbox? That's where I stumble too. I wrestled with one for a while this morning then gave up. I'm pretty sure I've gotten it to work before though. Also that it was covered in a class I took years ago, so I have the book here and I intend to have a look... later.
|
|
|
|
|
hi everyone
I'm sure that thw solution is going to very simple.
i'm trying to get a yes or no answer from in my program. I don't understand it is not working:
Console.WriteLine("Would you like to transform another grade (Y/N)");
char yesOrNoAgain = char.Parse(Console.ReadLine());
char.ToUpper(yesOrNoAgain);
if (yesOrNoAgain == 'Y')
{
}
else if (yesOrNoAgain =='N')
{
else
{
}
the grogram doesn't recognize the capital Y or capital N.
can someone show me my error.
thanks
|
|
|
|
|
the problem is on the char.ToUpper line. If you check carefully you'll see that ToUpper returns a new char, it doesn't alter the existing one (google for immutable).
To fix it you need to use:
yesOrNoAgain = char.ToUpper(yesOrNoAgain);
|
|
|
|
|
|
Before posting here again please read this[^]
"Help is need" Of course it is, why else are you here!
only two letters away from being an asset
|
|
|
|
|
Why not a switch?
switch ( Console.ReadLine() [ 0 ].ToUpper() )
{
case 'Y' : ...
case 'N' : ...
}
Though even that will blow up when the user hits RETURN without typing anything.
On the other hand, in light of the Lounge thread concerning "duct tape programmers", I present some code I wrote a few days ago:
private readonly static System.Collections.Generic.Dictionary<string,bool> boolifier ;
boolifier = new System.Collections.Generic.Dictionary<string,bool>
(
System.StringComparer.CurrentCultureIgnoreCase
) ;
boolifier [ "TRUE" ] = true ;
boolifier [ "TRU" ] = true ;
boolifier [ "TR" ] = true ;
boolifier [ "T" ] = true ;
boolifier [ "YES" ] = true ;
boolifier [ "YE" ] = true ;
boolifier [ "Y" ] = true ;
boolifier [ "1" ] = true ;
boolifier [ "FALSE" ] = false ;
boolifier [ "FALS" ] = false ;
boolifier [ "FAL" ] = false ;
boolifier [ "FA" ] = false ;
boolifier [ "F" ] = false ;
boolifier [ "NO" ] = false ;
boolifier [ "N" ] = false ;
boolifier [ "0" ] = false ;
private static bool
PromptForYesNo
(
string Prompt
)
{
string temp = PromptForEntry ( Prompt , false ) ; // Basically WriteLine and ReadLine like you have
return
(
boolifier.ContainsKey ( temp )
&&
boolifier [ temp ]
) ;
}
|
|
|
|
|
Then why even put in the falses? If you leave all of those out, you'll still get false when you need it
|
|
|
|
|
true
a simple list and a return list.Contains(key) would do. Saves a lot of duct tape. Joel, where are you?
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|