Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
Questionwpf OR windows forms ???memberMohamad Shahmardan16 Jan '13 - 3:56 
which one is more useful ?
why?
AnswerRe: wpf OR windows forms ???mvpRichard MacCutchan16 Jan '13 - 4:20 
How do you define "more useful"? There are many reasons why you would choose one over the other but it will depend on the problem you are trying to solve and the skill levels and experience of your developers.
One of these days I'm going to think of a really clever signature.

AnswerRe: wpf OR windows forms ???protectorPete O'Hanlon16 Jan '13 - 4:26 
That question is about as clearly defined as "apples or oranges?" why?.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

AnswerRe: wpf OR windows forms ???mvpDave Kreskowiak16 Jan '13 - 4:57 
Neither.

AnswerRe: wpf OR windows forms ???member ProgramFOX16 Jan '13 - 5:26 
Hi,
 
Read this:
WPF vs. Windows Forms[^]
In some cases, my signature will be longer than my message...
<em style="color:red"> <b>ProgramFOX</b></em>
ProgramFOX

AnswerRe: wpf OR windows forms ???mvpAbhinav S16 Jan '13 - 7:19 
Windows Form is now "dated" and is not expected to get a lot of support from MS.
WPF was considered to be the replacement.
 
Metro apps and Xaml based programming may be the future.
So your question is quite tricky.
 
Building a WPF will help you learn xaml programming which could help you developing Metro apps as well - so I guess WPF might just be better.

AnswerRe: wpf OR windows forms ???memberMohamad Shahmardan16 Jan '13 - 8:26 
thanks alot my friends
AnswerRe: wpf OR windows forms ???memberPIEBALDconsult16 Jan '13 - 11:16 
Both.
QuestionWMI causing Access is deniedmembervanikanc16 Jan '13 - 3:36 
Hi,
 
I created a new account on the remote server and gave it Admin priviledges.
 
I am trying to execute an exe using this new account and it comes back with Access is Denied.
 
Is this something to do with this newly created account?
 
Thanks so much!
AnswerRe: WMI causing Access is deniedmvpDave Kreskowiak16 Jan '13 - 3:41 
You haven't specified HOW you're trying to launch this .EXE and what this has to do with WMI.

GeneralRe: WMI causing Access is deniedmembervanikanc16 Jan '13 - 3:56 
ConnectionOptions opts = new ConnectionOptions();
opts.Username = "my_username"
opts.Password = "my_pwd";
 
ManagementPath path = new ManagementPath(@"\\<myserver>\root\cimv2:Win32_Process");
ManagementScope scope = new ManagementScope(path, opts);
scope.Connect();
ObjectGetOptions getopts = new ObjectGetOptions();
ManagementClass mgClass = new ManagementClass(scope, path, getopts);
ManagementBaseObject inParams = mgClass.GetMethodParameters("Create");
 
//Fill in input parameter values
inParams["CommandLine"] = @"\\<myprogramlocation>\myprogram.exe";
 
//Execute the method
ManagementBaseObject outParams = mgClass.InvokeMethod("Create", inParams, null);

GeneralRe: WMI causing Access is deniedmembervanikanc16 Jan '13 - 4:31 
It is an account issue, the account set up on the remote server needs to be a domain account. An account specific to that computer is not working.
GeneralRe: WMI causing Access is deniedmvpDave Kreskowiak16 Jan '13 - 4:55 
It doesn't need to be a domain account...
 
It just needs to be an account that your code knows about and can pass credentials for.

GeneralRe: WMI causing Access is deniedmvpDave Kreskowiak16 Jan '13 - 4:57 
You get Access Denied because the account your code is running under does not have permissions to the remote machine. By default, if you don't specify any account information in the Management connection objects, it'll use the account your code is running under. If that account doesn't have permissions on the remote machine, it'll fail.

QuestionProblem getting data from a stored procedure (Oracle) [modified]memberGDavy16 Jan '13 - 3:11 
On the Oracle DB there's a stored proc defined like:
 
PROCEDURE pGetHashes ( iFrom IN NUMBER, iTo IN NUMBER, sHash1 OUT CHAR, sHash2 OUT CHAR );
 
When I call this procedure from within my app, I only get a value for the sHash2 parameter. The value of the sHash1 parameter is always null. (Running the same stored proc from sqldeveloper gives a result for both hash values.)
Underneath I have added the code which I use to call the stored proc. Does anybody see anything I might have done wrong?
 
                int iFrom = 0;
                int iTo = 1000;
                using (IDbCommand command = dbConnection.CreateCommand())
                {
                    OracleCommand orclCommand = command as OracleCommand;
                    orclCommand.CommandText = "pGetHashes";
                    orclCommand.CommandType = CommandType.StoredProcedure;
                    
                    orclCommand.Parameters.Clear();
                    orclCommand.Parameters.Add("iFrom", OracleDbType.Int32, iFrom, ParameterDirection.Input);
                    orclCommand.Parameters.Add("iTo", OracleDbType.Int32, iTo, ParameterDirection.Input);
 
                    OracleParameter orclParam = new OracleParameter("sHash1", OracleDbType.Char, 100);
                    orclParam.Direction = ParameterDirection.Output;
                    orclCommand.Parameters.Add(orclParam);
                    orclParam = new OracleParameter("sHash2", OracleDbType.Char, 100);
                    orclParam.Direction = ParameterDirection.Output;
                    orclCommand.Parameters.Add(orclParam);
 
                    orclCommand.BindByName = true;
 
                    orclCommand.ExecuteNonQuery();
 
                    // after this the orclCommand.Parameters["sHash1"].Value is always null. 
                    // the orclCommand.Parameters["sHash2"].Value has the correct value.
                }
 
For extra documentation. Running the following PLSQL from within sqldeveloper results in both a value for Hash1 and Hash2:
 
SET SERVEROUTPUT ON;
DECLARE 
sHash1 CHAR(67);
sHash2 CHAR(67);
nFrom NUMBER := 0;
nTo NUMBER := 1000;
BEGIN
 
pGetHashes( nFrom, nTo, sHash1, sHash2 );
 
dbms_output.put_line('Hash1: '|| sHash1);
dbms_output.put_line('Hash2: '|| sHash2);
END;
 
Thanks for any light you can shed on this problem.

modified 17 Jan '13 - 2:00.

AnswerRe: Problem getting data from a stored procedure (Oracle)membermicke.andersson28 Jan '13 - 3:39 
Maybe you need two orclParam variables?
 
You create it with:
 
OracleParameter orclParam = new OracleParameter("sHash1", OracleDbType.Char, 100);
 
But later you assign a new object to it:
 
orclParam = new OracleParameter("sHash2", OracleDbType.Char, 100);
 
I would be very surprised if this fixes your problem but it might be worth a try? If it fixes your problem then the Add() function is implemented... in a peculiar way.
QuestionC#, Windows 8 UAC, and registry editmemberclover4leaves16 Jan '13 - 2:46 
Dear all,
 
My application works well on Vista, Win 7 32 and 64 bits.
It modifies some registry key in HKEY_LOCAL_MACHINE.
 
But when run on Win 8 (both 32 and 64), with minimum level UAC (I drag the slider to bottom, then restart), it doesn't work. And there is the error:
 
"Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework Configuration tool. Requested registry access is not allowed."

 
When I disable completely UAC of win 8 by editing registry, then restart computer, my application works well.
 
How can I deal with win 8 UAC enable with c#?
 
Thank you very much.
AnswerRe: C#, Windows 8 UAC, and registry editmemberjschell16 Jan '13 - 9:19 
If I run regedit on Windows 7 then it runs with elevated priviledges which causes a UAC dialog to pop.
 
I find it unlikely that your application is doing nothing and yet is allowed total access to the registry on Windows 7. Do you have UAC enabled on your Windows 7 test box? Are you only editing some user data and as such the app might have access? Or perhaps are you installing it on Windows 7 (installing does seem to provide certain priviledges)? Also are you sure that the user for windows 7 and that for 8 both have the same priviledges?
GeneralRe: C#, Windows 8 UAC, and registry editmemberclover4leaves16 Jan '13 - 14:00 
My application works well on win 7 (32/64) with UAC enabled, it requires to run as Administrator.
 
But when run this application as Administrator on win 8 (my user is in Administrators group), it gave me the error above. It just runs well when I disable UAC by registry editing.
GeneralRe: C#, Windows 8 UAC, and registry editmemberJonathan C Dickinson17 Jan '13 - 2:00 
You might be trying to modify TrustedInstaller keys. TrustedInstaller is a special user that has power beyond that of Administrator(s). You will need to take ownership of the key in order to work around that (completely ruining the security on your user's machine). If you need to change keys owned by TrustedInstaller you are doing something very very wrong.
 
If you are not trying to modify TrustedInstaller-owned keys you probably need to indicate which permissions you want when you open the key:
 
using (var key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
{
}
// .. or ..
using (var key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
{
}
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb]
 
Jonathan C Dickinson (C# Software Engineer)

GeneralRe: C#, Windows 8 UAC, and registry editmemberclover4leaves17 Jan '13 - 4:09 
I owned this registry key, and I can do what the app should do by hand using regedit.
 
This is one line of my code, works well under Vista, Win 7, it just has problem with Win 8 UAC enabled.
RegistryKey rk = Registry.ClassesRoot.OpenSubKey(subkey, RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl);

QuestionCombo box selection eventmemberTrishal15 Jan '13 - 19:59 
I am currently a student in TYBSC(IT) so I had a query that in C# windows form If for example a clientname combobox is there and on selecting the client Name in the combobox the 2 text boxes clientAddress and ClientNumber should be retrieved from the database and get filled in the textboxes.
Sir please help me in my project my mailing me a demo program so that I can Find A Solution to It.
Please Sir and as sson as possible as jan end is ma submission dateThumbs Down | :thumbsdown:
trishal

AnswerRe: Combo box selection eventmvpAbhinav S15 Jan '13 - 21:38 
Try something and if you run into issues, post what you have done here.
Someone might be able to help you.

AnswerRe: Combo box selection eventmemberTrishal15 Jan '13 - 22:37 
Sir can you give me your email id son that i will send my code to you its having some errors can you correct and give me???
GeneralRe: Combo box selection eventmvpRichard MacCutchan15 Jan '13 - 22:50 
Show your code (just the part with the errors) and the error messages here, and people will try to help you.
One of these days I'm going to think of a really clever signature.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid