|
Hi,
string.Replace creates and returns a new string, so do strBody.Replace(...) ;
that also is why the second way does work.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hi,
nothing gets replaced, since there is no match: "Vuyiswa" and "secret" are not present in the original strBody.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
That means the Replace Function intellisense is misleading because it says
strBody.Replace(char oldchar,char newChar)
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
that is just one of the functions signatures, the other is with string types instead of char types
your intellisense should show multiple signatures available that you can cycle through with the Up/Down arrow keys
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I see
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Vuyiswa Maseko wrote: strBody.Replace(char oldchar,char newChar)
that is completely irrelevant, your original post and my reply to it referred to Regex.Replace, not string.Replace; and there are no char variables present at all.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Correct , what am saying is that the normal replace has those arguments. So i changed from Regex to use normal replace.
thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
ahhh... the parameters are in the wrong order. Good Spot!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: Good Spot!
Not really. If a replace operation fails, either you did not catch the result, or there was no match to begin with. How hard can it be?
BTW: the OP made both mistakes in this thread.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
oh don't get me wrong if I was coding it myself I would know the match had failed as I would have had the parameters in the right order.
But I did not spot that it is the second param that is the search pattern and the third is the replace just by looking at his code. Mainly because I dont use the Regex function often (but we have had that discussion[^] before )
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Yeah, it was another regex abuse, there wasn't any real pattern to match, or special substitution going on, just a simple string.Replace; and my view on regex hasn't changed since our last encounter on the subject
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
i want to know how i can access to sectors used by typical file to read and write directly them in c#
and i need the methods that read and write hard disk sectors directly
thanks
|
|
|
|
|
Use PInvoke. OpenFile(@"\\.\A:", ...), where A: is the drive you want to read. SetFilePointer(startSector). ReadFile(512*numberOfSectors)
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Why would you need to do this??
|
|
|
|
|
so what your saying is you don't know...
|
|
|
|
|
Yes, I do know how to read/write disk sectors. No, I have no idea why he would want to do this.
|
|
|
|
|
well I do not know why he would want to read / write directly to the FAT / NTFS but I would like to tag files with extra infomation, that my compnay would find helpful...
so if you know how Ican do this from c# then that would be handy.
|
|
|
|
|
Hi,
Can anybody have anyidea about to get stream or video from a Ip Camera using URL in C#.Net
Thanks in advance.
Dinker
|
|
|
|
|
This question is incredibly confusing to me, define 'Ip Camera' (access a webcam remotely?) and what do you mean URL? Is it a video feed through the internet or through a network?
|
|
|
|
|
hi
with GraphicsPath.AddEllipse i created ellipse,if i use GetBounds() i get the bounds of the ellipse,
now if i want to rotate the ellipse keeping the same bounding rectangle how do i calculate the new ellipse to create?
|
|
|
|
|
Hello,
I have a problem, i have created a form and a user control. I have a database on SQL server. I have a combobox on my usercontrol and i would like to implement my combobox with my database. i've used the properties of the combobox to choose the datasource and choose my database and the right table but my combobox is empty.
Whereas if i create a combobox in my form and did the same things with my combobox i have the data inside.
I've tried lot of things but nothing is working , if someone know how to do this i would be very grateful
Thanks
|
|
|
|
|
Can we see some code to see where the error is?
|
|
|
|
|
I don't have any error, it just that i have no data in my combobox.
For the code i'm using the wizard datasource in the combobox propriété in Visual Studio.
The wizard create a dataset ( with the name of my database), a Bindingsource and a TableAdapter ( with the name of the table i want)
I can show you some code of one of this composant if you want?
Thanks
|
|
|
|
|
Without seeing how you're binding your data source to your control there could be many things going wrong...
|
|
|
|
|
this code can help you ?
It's in the designer of my combobox
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.licenceDataSet = new test_datasource.licenceDataSet();
this.companyBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.companyTableAdapter = new test_datasource.licenceDataSetTableAdapters.companyTableAdapter();
this.licenceDataSet1 = new test_datasource.licenceDataSet1();
this.companyBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.companyTableAdapter1 = new test_datasource.licenceDataSet1TableAdapters.companyTableAdapter();
((System.ComponentModel.ISupportInitialize)(this.licenceDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.companyBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.licenceDataSet1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.companyBindingSource1)).BeginInit();
this.SuspendLayout();
this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.companyBindingSource, "nom", true));
this.comboBox1.DataSource = this.companyBindingSource1;
this.comboBox1.DisplayMember = "nom";
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(28, 24);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
this.comboBox1.ValueMember = "cid";
this.licenceDataSet.DataSetName = "licenceDataSet";
this.licenceDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
this.companyBindingSource.DataMember = "company";
this.companyBindingSource.DataSource = this.licenceDataSet;
this.companyTableAdapter.ClearBeforeFill = true;
this.licenceDataSet1.DataSetName = "licenceDataSet1";
this.licenceDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
this.companyBindingSource1.DataMember = "company";
this.companyBindingSource1.DataSource = this.licenceDataSet1;
this.companyTableAdapter1.ClearBeforeFill = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.comboBox1);
this.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.companyBindingSource, "nom", true, System.Windows.Forms.DataSourceUpdateMode.Never));
this.Name = "combo";
((System.ComponentModel.ISupportInitialize)(this.licenceDataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.companyBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.licenceDataSet1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.companyBindingSource1)).EndInit();
this.ResumeLayout(false);
|
|
|
|