|
I successful converted my project from VB to C# than I deleted an Equipment form from my C# project but when I run my C# project the form appeared in debug mode, How to solve this problem?
|
|
|
|
|
Probably, you didn't compile it after removing the form, or the compilation failed.
Did it say something along the lines of "do you want to run the last successful build instead?" and you said "yes"?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It says "do you want to run the last successful build instead?";
then I press "Yes";
|
|
|
|
|
So...you try to compile it, it can't do it completely because of errors, then you run the "last successful" build and expect it to have your latest changes in it?
Tell me, if you go the the supermarket and don't have any money on you when you try to pay, does the checkout person say "would you like the previous customer to pay for you?" - because that is what you are trying to get the system to do.
When you compile a program, any errors prevent the system from producing a new executable file - so the exe that is run is the last version of your code that had no errors, not the latest version with your changes. In order to run your code with your changes included, you have to look at and fix the errors that the compiler found and told you about.
So what errors did you get?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
WOW Thanks ORIGINALGRIFF;
It's sorted now thanks hey....
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi all,
i have a .dotx file with some custom property that i have to change by C#. I have downloaded OpenXml sdk library and i just found a way to find all custom properties in a word document but i don't know how edit their value. For example : custom property "Author" with value "Sam" become "Simon".
Any ideas?
Thank you
|
|
|
|
|
|
hello experts,
i am appreciating some help in if then else statement in crystal report.
numbervar x:={ev1.Hpronunciation};
if({ev1.class}="LKG" OR {ev1.class}="UKG") then
(
if(x>=9 and x<=10 )
then
"A+"
else if(x>=6 and x<=8 )
then
"A"
else if(x>=4 and x<=5 )
then
"B+"
else if(x>=3 and x<4 )
then
"B"
else if( x<3 )
then
"C"
else if( x=999 )
then
"AB"
else if( x=0 )
then
"*"
else
"")
else
(
if(x=5 )
then
"A+"
else if(x=4 )
then
"A"
else if(x=3 )
then
"B+"
else if(x=2 )
then
"B"
else if( x<2 )
then
"C"
else if( x=999 )
then
"AB"
else if( x=0 )
then
"*") ;
i am getting correct result for first condition ,but blank result for else ,can any one help me figure out where i am wrong
|
|
|
|
|
You should not be doing this processing in the report, it should be part of your dataset and supplied in the source query/procedure.
A report should only do grouping and totally on a processed data source. there are exception but this is not one of them.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
please check your last condition part in Else that is
Correct code - New code
else
(
if(x=5 ) then
"A+"
else if(x=4 ) then
"A"
else if(x=3 ) then
"B+"
else if(x=2 ) then
"B"
else if( x<2 ) then
"C"
else if( x=999 ) then
"AB"
else "*") ;
instead of
Error in your code - Old code
else
(
if(x=5 ) then
"A+"
else if(x=4 ) then
"A"
else if(x=3 ) then
"B+"
else if(x=2 ) then
"B"
else if( x<2 ) then
"C"
else if( x=999 ) then
"AB"
else if( x=0 ) then
"*") ;
Don't use then in last else portion and remove last else condition that is if(x=0).
|
|
|
|
|
I don't have any conditions but the OP may still have.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have .NET WinForm application in C# and I will make Web application for it using PHP.
I would like to ask what's the best way to encrypt / decrypt user authentication so it wll work on both WinForm and PHP portal?
I am currently using this in C#:
user_password = cipher_utility.Encrypt<RijndaelManaged>(result, "xxxx", "xxxxxxxxx");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace Application_Class_Library
{
public class cipher_utility
{
public static string Encrypt<T>(string value, string password, string salt) where T : SymmetricAlgorithm, new()
{
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
SymmetricAlgorithm algorithm = new T();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateEncryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream())
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Write))
{
using (StreamWriter writer = new StreamWriter(stream, Encoding.Unicode))
{
writer.Write(value);
}
}
return Convert.ToBase64String(buffer.ToArray());
}
}
public static string Decrypt<T>(string text, string password, string salt) where T : SymmetricAlgorithm, new()
{
DeriveBytes rgb = new Rfc2898DeriveBytes(password, Encoding.Unicode.GetBytes(salt));
SymmetricAlgorithm algorithm = new T();
byte[] rgbKey = rgb.GetBytes(algorithm.KeySize >> 3);
byte[] rgbIV = rgb.GetBytes(algorithm.BlockSize >> 3);
ICryptoTransform transform = algorithm.CreateDecryptor(rgbKey, rgbIV);
using (MemoryStream buffer = new MemoryStream(Convert.FromBase64String(text)))
{
using (CryptoStream stream = new CryptoStream(buffer, transform, CryptoStreamMode.Read))
{
using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
{
return reader.ReadToEnd();
}
}
}
}
}
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
As has been explained in your previous question, you should never encrypt passwords. Use a one-way hash with a salt value and store that in your database. When someone tries to login you compare the hashed value with what is stored. In that way the passwords are much more secure because they cannot be decrypted. See Secure Password Authentication Explained Simply[^] for details on how it should be done.
|
|
|
|
|
I don't understand why my code snippet below won't find "14" and set the .SelectedIndex? The .Selectindex is always -1.
comboBoxLSKFontSize.Items.Add("10";);
comboBoxLSKFontSize.Items.Add("11";);
comboBoxLSKFontSize.Items.Add("12";);
comboBoxLSKFontSize.Items.Add("13";);
comboBoxLSKFontSize.Items.Add("14";);
comboBoxLSKFontSize.Items.Add("15";);
comboBoxLSKFontSize.Items.Add("16";);
stringLSKFontSize = "14";
i = 0;
foreach (string str in comboBoxLSKFontSize.Items)
{
if (stringLSKFontSize == str)
{
comboBoxLSKFontSize.SelectedIndex = i;
break;
}
i++;
}
|
|
|
|
|
Your code would work if you cleaned up the many obvious syntax errors in it so it would compile without error !
«I'm asked why doesn't C# implement feature X all the time. The answer's always the same: because no one ever designed, specified, implemented, tested, documented, shipped that feature. All six of those things are necessary to make a feature happen. They all cost huge amounts of time, effort and money.» Eric Lippert, Microsoft, 2009
|
|
|
|
|
As Bill says: if you fix the syntax errors by removing the spurious semicolons:
comboBoxLSKFontSize.Items.Add("10");
comboBoxLSKFontSize.Items.Add("11");
comboBoxLSKFontSize.Items.Add("12");
comboBoxLSKFontSize.Items.Add("13");
comboBoxLSKFontSize.Items.Add("14");
comboBoxLSKFontSize.Items.Add("15");
comboBoxLSKFontSize.Items.Add("16");
stringLSKFontSize = "14";
i = 0;
foreach (string str in comboBoxLSKFontSize.Items)
{
if (stringLSKFontSize == str)
{
comboBoxLSKFontSize.SelectedIndex = i;
break;
}
i++;
}
Then that code should work, assuming that stringLSKFontSize and i have been declared. But with the errors, it won't compile, which means that it doesn't produce an executable file, so you will be running the last version that did compile correctly and your changes do not have effect.
If once it compiles you still have the problem, then use the debugger by putting a breakpoint on the line:
stringLSKFontSize = "14";
And step though your code to find out exactly what it is doing.
And you do realise that you don't have to do that at all, right?
comboBoxLSKFontSize.Items.Add("10");
comboBoxLSKFontSize.Items.Add("11");
comboBoxLSKFontSize.Items.Add("12");
comboBoxLSKFontSize.Items.Add("13");
comboBoxLSKFontSize.Items.Add("14");
comboBoxLSKFontSize.Items.Add("15");
comboBoxLSKFontSize.Items.Add("16");
comboBoxLSKFontSize.SelectedItem = "14";
Will do exactly the same thing...
BTW: It's not considered good practice to put the type of the variable as part of the variable name: you should consider using just LSKFontSize and LSKSelectedFontSize instead. Visual Studio will tell you the type of a variable if you just wave your mouse over the variable name.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Thanks for taking the time to detail your response Griff...!!!
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
hi guys ;
how to add a image to header of exportinf pdf in devexpress gridview
|
|
|
|
|
Could someone please explain to me what´s going on in this conversion. I dont understand the result.
byte[] arr = new byte[6] { 68, 65, 84, 65, 13, 10 };
string str = Encoding.ASCII.GetString(arr);
According to the ASCII table the bytes mean DATA\n\t. (13=CR='\n', 10=LF='\r') But the string receives DATA\t\n !?!
If I change their places { 68, 65, 84, 65, 10, 13 } the string receives DATA\n\t.
Why does the CR and LF change place? Im really confused here.
|
|
|
|
|
You have the nomenclature a little mixed up:
CR = 13 = '\r'
LF = 10 = '\n'
TAB = 9 = '\t'
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thankyou! Thought I was getting insane.
|
|
|
|
|
I use C dll functions in C#. It works fine except I have a memory leak.
The first C function I use allocates memory (with malloc) and returns an array of string (char***) and the second one frees the memory (using free).
When I test those functions in a C program everything is ok - there are no memory leaks. However when I use those functions in a simple C# program using just thos functions I have a memory leak.
I 'm sure I'm doing something bad but I can't figure out what.
My code :
[DllImport("TestERP.dll", CallingConvention = CallingConvention.StdCall)]
private static extern int GetArray(string baseval,ref int nb,ref IntPtr array,IntPtr msg);
[DllImport("TestERP.dll", CallingConvention = CallingConvention.StdCall)]
private static extern int freeMemory( int nb, ref IntPtr array);
public static void GetManagedArray()
{
string[] tmp = new string[12];
int nb = 0;
IntPtr msg = Marshal.AllocHGlobal(256);
string tmp2 = "";
IntPtr intArr = IntPtr.Zero;
GetArray("val",ref nb, ref intArr,msg);
for (int i = 0; i < nb; i++)
tmp[i] = Marshal.PtrToStringAnsi(Marshal.ReadIntPtr(intArr, i * IntPtr.Size));
tmp2 = Marshal.PtrToStringAnsi(msg);
Marshal.FreeHGlobal(msg);
freeMemory(nb, ref intArr);
intArr = IntPtr.Zero;
GC.Collect();
}
I add the code of C functions :
int __stdcall GetArray(char base[],int* nb,char*** array,char* outmsg)
{
int i =0;
(*array) = (char**)calloc(12, sizeof(char*));
for (i = 0; i < 12; i++)
{
(*array)[i] = calloc(256,sizeof(char));
sprintf((*array)[i],"%s %d",base,i) ;
}
*nb= 12;
strcpy(outmsg,"message erreur");
return 0;
}
int __stdcall freeMemory(int nb,char*** array)
{
int i =0;
for (i = 0; i < nb; i++)
{
free((*array)[i]);
(*array)[i] = NULL;
}
free((*array));
*array = NULL;
return 0;
}
|
|
|
|
|
What you haven't mentioned is what makes you think you have a memory leak?
If you're using TaskManager to tell you this, it's lying to you.
Use PerfMon instead.
|
|
|
|