|
i want to delete a string from right of 10 places
Eg..
String = http://www.bharathretail.com/cyberwing/update_ip.php?gid=4274725472424242
but i want
string = http://www.bharathretail.com/cyberwing/update_ip.php
plz help..
Elizabeth...
|
|
|
|
|
string = string.substring(0,string.length -11)
|
|
|
|
|
Instead of removing 10 char from right you can use split function
Because not necessary that always you have 10 characters after “?”,
string path = "http://www.bharathretail.com/cyberwing/update_ip.php?gid=4274725472424242";
string[] ar = path.Split('?');
MessageBox.Show(ar[0]);
Amit
|
|
|
|
|
either you count in base 21 (that would be unumvigintal), or your example is wrong.
if you want to get rid of the querystring in string s, use s=s.Split('?')[0];
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I am working on Windows application and I created the validation for English language by using “RegularExpressions”. Now my application need to support Spanish language and my English validations are not working in Spanish.
Please help me what should I do.
Thanks in Advance
Amit
Amit
|
|
|
|
|
If you're just using regexes, then you simply add Spanish-validating regexes to your Resources. Then use something like this:
if(Spanish)
RegexValidate(SpanishRegex);
else if(English)
RegexValidate(EnglishRegex);
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Hi
Thanks for reply, but how to write "Spanish-validating regexes".
Because in English we use
"Regex objAlphaPattern = new Regex("[^a-zA-Z]");"
But what I need to write for Spanish.
Thanks
Amit
Amit
|
|
|
|
|
To be honest, I've not gone into regexes in detail. Spanish seems to use the same alphabet, plus some, so you could in theory use the same regex. I just don't know how to include the vowels with an acute accent and diaeresis. Perhaps this link may help
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I don't think so. Rather than having lots of conditionals, just pull the regex expressions from a string resource, same as the GUI stuff.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I hadn't thought of that. Thanks for the tip. But how would you handle the case that a user wanted to change languages on the fly, apart from recompiling the application with the correct regex expressions?
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I don't know the details and have no experience with the subject, however I do vaguely remember an article showing how a GUI language can be changed on the fly; it was based on those regional DLLs Visual Studio and/or .NET support for internationalization.
One probably would have to come up with another solution if one needed multiple languages on a Form, independent of the GUI language itself. Say a translator app.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
pls help me to read a text file from other machine....
|
|
|
|
|
The only way you can do that is if the folder containing the text file is shared, and the user logged into the pc that is using your program has the permissions to access that folder.
If these conditions are met you can just read the text file as if it was on the local machine. (path will be something like: \\sharedfolder\textfile.txt )
Of course if your asking for the actual code for reading a text file I'd normally tell you to go read a beginners book (on programming) since this is one of the most basic things you can do and every book handles it in one of the first chapters.
|
|
|
|
|
Hi,
First of all, excuse my English.
My app (Compact Framework) loads 2 copies if the same dll (exactly the same DLL renamed) using reflection.
The DLL should load the corresponding config file according to the DLL name (if the DLL is ModuleA.dll the config is ModuleA.txt, and so on).
My problem is this:
When I load the first DLL, everything goes OK, but when I load the second one when I do Assembly.LoadFrom( FullPath ) it loads the first DLL insteag of the 2nd one, despite the fact that FullPath contains the first DLL's path.
In addition there are the variables which shoul be global to each DLL. As everything is loaded from the first DLL, the globals are the first DLL's ones.
After looking for info I realised that what I need to do is to load each DLL in a different AppDomain, so they are isolated from each other.
To summarize:
One compilation: MyModule.dll
2 copies of the same DLL: MyModuleA.dll & MyModuleB.dll
One config file for each DLL: MyModuleA.txt & MyModuleB.txt
One appdomain for each DLL is needed.
Anyone knows how to do this in Compact Framework?
|
|
|
|
|
hi
use LoadFile instead of LoadFrom.
this will help you more
www.codeproject.com/KB/dotnet/AssemblyLoadFile.aspx
cheers
|
|
|
|
|
Thanks for your answer, but i'm afraid it doesn't work in compact framework (mobile), at least in NETCF 2.0.
Thankyou anyway.
|
|
|
|
|
Here's a snippet from one of my classes:
name = System.IO.Path.GetFileNameWithoutExtension ( Filename ) ;
assm = System.AppDomain.CreateDomain ( name ).
Load ( System.IO.File.ReadAllBytes ( Filename ) ) ;
|
|
|
|
|
I'm afraid this doesn't work on Compact Framework 2.0.
Thankyou anyway.
'System.AppDomain' no contiene una definición para 'Load'
'System.IO.File' no contiene una definición para 'ReadAllBytes'
In English:
'System.AppDomain' doesn't contain a definition for 'Load'
'System.IO.File' doesn't contain a definition for 'ReadAllBytes'
|
|
|
|
|
Hi
I want to pass values from one form to another form in windows application. Can anyone help me plz with sample code...
Thanks in advance...
Elizabeth......
|
|
|
|
|
Levae alone Google, did you try to even serach in CP.
I found these [^]answers already present.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Well I think the best option would be to create properties[^] in the form you want to pass them to and then set those properties with the values...
private string myProperty = "Default Value";
public string MyProperty{
get{return myProperty;}
set{myProperty = value;}
}
you could also pass through a method[^] in the second form...
public void SetValues(string val1, string val2, string val3)
{
MyVal1 = val1;
}
or you could have a list of static members[^] that all forms can access, but this may not be the best solution for what you want...
public static string Val1 = "My Val 1";
...all forms will be able to access this be reference the class/form is belongs to...
MyVal1 = Form1.Val1;
...hope that helps
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thank u its working.......
|
|
|
|
|
 To pass to a form that is a child (i.e. Form1 instanciates Form2 so Form2 is a child of Form1) use a property or method.
To pass from a child to a parent, use an event.
To pass between two children, use an event to notify the parent and the parent in turn uses a property/method to pass to the child.
The first two are in this example.
using System;
using System.Windows.Forms;
namespace ValuePassing
{
public class FormParent : Form
{
public FormParent()
{
Shown += new EventHandler(FormParent_Shown);
}
void FormParent_Shown(object sender, EventArgs e)
{
FormChild formChild = new FormChild();
formChild.ValueChanged += new EventHandler<ValueChangedEventArgs>(formChild_ValueChanged);
formChild.VisibleToParentMethod(100);
formChild.VisibleToParentProperty = 200;
}
void formChild_ValueChanged(object sender, ValueChangedEventArgs e)
{
Text = (string.Format("Value = {0}", e.Value));
}
}
public class FormChild : Form
{
public event EventHandler<ValueChangedEventArgs> ValueChanged;
private int visibleToParentValue;
public int VisibleToParentProperty
{
get { return visibleToParentValue; }
set
{
MessageBox.Show("Property");
SetVisibleToParentValue(value);
}
}
public void VisibleToParentMethod(int value)
{
MessageBox.Show("Method");
SetVisibleToParentValue(value);
}
private void SetVisibleToParentValue(int value)
{
if (visibleToParentValue != value)
{
visibleToParentValue = value;
OnVisibleToParentValueChanged(new ValueChangedEventArgs(value));
}
}
protected virtual void OnVisibleToParentValueChanged(ValueChangedEventArgs e)
{
EventHandler<ValueChangedEventArgs> eh = ValueChanged;
if (eh != null)
eh(this, e);
}
}
public class ValueChangedEventArgs : EventArgs
{
public ValueChangedEventArgs(int value)
{
Value = value;
}
public int Value
{
get;
private set;
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi Experts,
I would like to add a usercontrol to Window.ie to Operating systems Window.
when ever i open a MyComputer or MyDocuments, Mine usercontrol should be displayed on it
Thanks
|
|
|
|
|