|
Hi, i have an hexadecimal value for the return value.
I ask myself if i must continue to this way, i read somewhere else it was an old way to do it like a c++ copy/paste. I would to have something quick, with all default icons (i don't know another way for folders than to use win32.dll this is why i thought about make all with api methods)
Meanwhile, to go forward i found a way to get mega folders, i post here if it can help others.
var identity = System.Security.Principal.WindowsIdentity.GetCurrent();
string userName = identity.Name.ToString();
string userSID = identity.User.ToString();
List<string> MegaFolderPaths = new List<string>();
RegistryKey clsidKey = Registry.Users.OpenSubKey($"{userSID}\\Software\\Classes\\CLSID");
foreach (string subKey in clsidKey.GetSubKeyNames())
{
RegistryKey clsidSubKey = Registry.Users.OpenSubKey($"{userSID}\\Software\\Classes\\CLSID\\{subKey}\\Instance\\InitPropertyBag");
if (clsidSubKey == null)
continue;
string defaultValue = (string)clsidSubKey.GetValue("TargetFolderPath");
if (!string.IsNullOrEmpty(defaultValue))
MegaFolderPaths.Add(defaultValue);
}
-------------------
Edit: for the chinese character i didn't see i forgot to add this
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
above
public static extern Int32 SHGetFileInfo(IntPtr pIDL, uint dwFileAttributes,
out SHFILEINFO psfi, uint cbFileInfo, uint uFlags);
modified 21-May-21 3:29am.
|
|
|
|
|
(beginner question)
I have a small app and a Class Library that generate a DLL and an EXE.
I read that I can use ILMerge to merge the DLL and EXE together.
The NuGet says the package is deprecated:
"This package has been deprecated as it is legacy and no longer maintained"
Is there something newer or another way to do this, merge the DLL and EXE ?
Thanks.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
|
I am trying to replace a text with something. most often it works but for a particular text replace not working. here is the code example.
string maindata = "Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
string data = "Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
string strformula = Regex.Replace(maindata, "\"" + data.Replace("(", "\\(").Replace(")", "\\)").Replace("$", "\\$") + "\"", "W51",RegexOptions.IgnoreCase);
strformula = maindata.Replace("\"" + data.Replace("(", "\\(").Replace(")", "\\)").Replace("$", "\\$") + "\"", "W51");
i tried both Regex.Replace() & String.Replace() but no luck. what is so special in the text "Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999" for which replace not working ?
please give me some direction. thanks
|
|
|
|
|
It might help if you could give some before and after examples, from what I can see nothing would change from the test data provided.
Do yourself a favour and don't chain the replace statements like that as it makes it difficult to see what is going on and almost impossible to debug and is a maintenance nightmare and is neither clever or helpful.
Split the whole line into discrete steps so you can examine what the before and after values are at each replace step.
|
|
|
|
|
Here i am posting simple replace. please run at your side then understand Replace() not able to replace.
string maindata = "Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
string data = "Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
string strformula = Regex.Replace(maindata, data , "W51",RegexOptions.None);
try my above code and must notice replace not able to replace Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999 with W51
Thanks
|
|
|
|
|
You need to escape the unescaped + character in your data string.
|
|
|
|
|
This code solve my issue. thanks a lot for your reply.
string maindata = @"Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
string data = @"Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
data = Regex.Escape(data);
string strformula = Regex.Replace("\"" + maindata + "\"", "\"" + data.Replace("(", "\\(").Replace(")", "\\)").Replace("$", "\\$") + "\"", "W51", RegexOptions.None);
|
|
|
|
|
Regexes can get quite complicated, and many characters are "special" - they tell the expression engine to do something specific.
'+' is one of them: it means "One or more of the previous item":
^A\d+B$ Will match an 'A' followed by any number of digits other than zero, then a 'B'.
If you need to use a "special character" as a literal charcater, you need to escpae it by prefixing it with a backslash:
^A\d\+B$ Will match an 'A' followed by a single of digit, then a '+', then a 'B'.
A1+B will match, A12B will not.
If you are going to use regexes, the get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
It'll help you a lot!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
This code solve my issue. thanks a lot for your reply.
string maindata = @"Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
string data = @"Operational Metrics~Domestic Subscribers Disney+~2015 FY~9999";
data = Regex.Escape(data);
string strformula = Regex.Replace("\"" + maindata + "\"", "\"" + data.Replace("(", "\\(").Replace(")", "\\)").Replace("$", "\\$") + "\"", "W51", RegexOptions.None);
|
|
|
|
|
It's fun to chain .Replace but it keeps you from knowing what's happening from one to the next.
It's not any faster than using the occasional intermediate variable.
If you chain that many, at least put them on a separate line.
string strformula = Regex.Replace(maindata, "\"" + data
.Replace("(", "\\(")
.Replace(")", "\\)")
.Replace("$", "\\$") + "\"", "W51",RegexOptions.IgnoreCase);
Then it should also be obvious that "data" should have it's own statement.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi, folks.
I'm programing in C# in Visual Studio 11. I changed a form font to bold (unique change) but as I didn't like the efect, I tried to return the form to regular text, but VS didn't return the form to regular font, no matter what. I noticed it's impossible to go back. Does anyone know how to do this? What am I doing wrong?
Thanks.
|
|
|
|
|
How did you change it, and how did you try to reset it?
|
|
|
|
|
Snap!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi, Richard.
I changed the font in the Properties Tab.
Do you have any idea?
Thanks.
|
|
|
|
|
Ismael Oliveira 2021 wrote: Do you have any idea? Sorry, no. Without more details we cannot even make a guess.
|
|
|
|
|
You are going to have to be a lot more explicit about exactly what you did - when I tried it by adding a new form, dropping a Label and TextBox on it, setting the TextBox text to "ASDFGHJKL", and then switchign the Form.Font.Bold property to "True" in the designer, it bolded all the text (other than the form caption).
Switching it back to "False" in the designer reversed that without problems.
So what did I do that you didn't?
And what version of VS are you actually using? They normal go by years: I run Visual Studio 2019 for example.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi, OriginalGriff.
I did the same as you. My VS is 2019, version 4.8.04084.The problem continues. I changed the font to Bold, and it worked fine, but the form changed the size (became a little bigger). Then I removed the Bold and the form removed the bold, but continued bigger. When I look at the form properties, the font appears as bold, although Bold is false.
I think the best to do is to recreate the form. If there is a way to include an image here, please tell me how, and I can show you what I'm saying.
Thank you.
|
|
|
|
|
Any Help, please
I am new in Web Service.
I have this WS
[ServiceContract]
public interface IWSEPSService
{
[OperationContract]
Persona ObtenerPersona(string id, string TipoDocumento);
[OperationContract]
Cliente SaveData(string documento, string tipoDocumneto);
}
[DataContract]
public class Persona : BaseRespuesta
{
[DataMember]
public string Nombre { get; set; }
[DataMember]
}
[DataContract]
public class Cliente : BaseRespuesta
{
[DataMember]
public int id { get; set; }
[DataMember]
public string direccion { get; set; }
more properties..
}
/* Class Persona */
public Persona ObtenerPersona(string Id, string tipoDocumento)
{
if (tipoDocumento == "Cedula")
{
if (ValidaCedula(Id) == false)
{
return new Persona() { Error = "Cedula erronea" };
}
}
/* Class CLiente */
public Cliente SaveData(string documento, string tipoDocumento)
{
if (tipoDocumento == "Cedula")
{
if (ValidaCedula(documento) == false)
{
return new Cliente() { Error = "Error Cedula incorreta." };
}
else
{
dt = ConsultaDatosClientes(documento, tipoDocumento);
foreach(DataRow row in dt.Rows)
{
if (tipoDocumento == "Cedula")
{
nombre = row["nombre"].ToString();
apellido = row["apellido"].ToString();
}
In the client Side I have this:
1. This code works perfect
private void button1_Click(object sender, EventArgs e)
{
var cedula = txtCedula.Text;
using(WSEPSService.WSEPSServiceClient client =new WSEPSService.WSEPSServiceClient())
{
var Persona = client.ObtenerPersona(cedula,"Cedula");
txtNombre.Text = Persona.Nombre + ' ' + Persona.Nombre;
txtEdad.Text = Persona.Edad.ToString();
}
}
2. This code does not work
private void btnSalvar_Click(object sender, EventArgs e)
{
using (WSEPSService.WSEPSServiceClient client = new WSEPSService.WSEPSServiceClient())
{
var Salvar= client.SaveData("10233317", "RNC"); // Here the program stopped
}
}
This is the Error:
System.ServiceModel.FaultException: 'The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.'
modified 12-May-21 11:20am.
|
|
|
|
|
Read the error message - it tells you exactly what to do to find out what the problem is:
'The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.'
So do what it says: turn it on and see what actual information it gives you!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Problems: Not the WS itself, error with password to access the DB.
|
|
|
|
|
|
Did you want to ask a question about code you're writing or did you just want to beg for code?
Begging for code isn't going to get you any where. This isn't a "code to order" site.
|
|
|
|
|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If I am researching a new technique or technology, something I like to do is look on Google to see what others have written about the topic. It's very rare that I can't find information supporting it. Sometimes, finding the answers you want is all about the keywords you use, so searching for k-medoids in C# really hit the spot. k-medoid clustering code c - Google Search[^]
|
|
|
|
|