|
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[^]
|
|
|
|
|
But ... but ... you are here to do that research for me so I can play video games!
"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!
|
|
|
|
|
I'm having trouble creating the 32-bit version of a registry key. In RegEdit I can see the 64-bit version of the key, but not the 32-bit version.
This is my code:
RegistryKey Key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
RegistryKey WowKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);
RegistryKey SubKey = Key.CreateSubKey(@"Software\Company Name\App Name");
RegistryKey WowSubKey = WowKey.CreateSubKey(@"Software\Company Name\App Name"); Where is the 32-bit version of the key supposed to show up in RegEdit?
I thought it's supposed to show up here:
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You're creating a key with the 32-bit view, but that doesn't mean the keys you create end up under Wow6432Node. It's being created exactly where you told it to be created:
HKEY_CURRENT_USER\SOFTWARE\Company Name\App Name
The first line creates the key, then the second line tries to create the same key but it's already there, so it just returns a handle to the existing key. You now have two views, 64 and 32-bit, of the exact same key.
Change the names of the keys you're creating in the 32-bit version of the code and watch what happens.
EDIT:
It doesn't seem changing the view does anything. Both views read/write to the exact same key.
|
|
|
|
|
Thank you for your response.
It would appear that that's exactly what's happening.
I'm creating the keys in a 64-bit application, but the keys will be read by both 64 and 32-bit applications.
Are you saying that if the key I create off the 32-bit view base key has a different name, then it will do what I expect?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
No, it'll just create the separate keys so you can see them both.
If you're going to write to anything under Wow6432Node, I think you have to build that into the path.
The real question is if you create the key under the normal path, "SOFTWARE\CompanyName\AppKey", is it still going to be readble by a 32-bit app on 64-bit Windows. I think that answer is yes.
|
|
|
|
|
I certainly thank you for the education. But I'm a little dismayed that it doesn't work the way I expected it to. It should open the 32-bit view if I specify so.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|