|
thanks man
I will try your links and thanks alot
Morg
|
|
|
|
|
Your first problem is the spaces between the digits.
Try something a bit simpler, and work your way up to the full expression:
"((0\s)|(27\s))(?<AreaCode>[0-9]{2})(?<LocalNumber>\s[0-9]{7})"
Feed this into Expresso[^] - examines and generates Regular expressions. It's free, and it really helps!
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
OriginalGriff wrote: Your first problem is the spaces between the digits
thanks man, with spaces I was just trying to indicate where the full number is branched or divided
I will try your idea and thanks alot
Morg
|
|
|
|
|
hey hey thanks man that program is so cool, I managed
to figure out what was wrong, the right expr:
Regex rx = new Regex("((?:\+27|27)|0)(72|82|73|83|74|84)(\d{7})");
Great one!
|
|
|
|
|
I wish I'd written it!
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Hi,
First of all, regular expression must be defined using a string, so you have to instanciate it that way :
Regex rx = new Regex("((?:\\+27|27)|0)(72|82|73|83|74|84)(\\d{7})");
Moreover, as OriginalGriff told you, consider using a tool like Expresso to build and test your regular expressions.
Regards.
|
|
|
|
|
|
Hello!
Recently I have troubles with the following problem.
There's a website (unfortunately it is htpps) where you need to enter 2 values in a form. After you press the button, a POST method is invoked and based on entered values some calculations are made. The final values are dynamically (ajax) put in the corresponding part of the page.
What I need to do is to read this values and store in my database.
My idea was somehow to get source page after all ajax calls are made and grab needed values from it. The problem I have encountered is that I cannot get that kind of source. Using System.Net.WebClient and its UploadStringAsync method I only get the primary source. I tried this source, and some other, async one using UploadStringAsync and UploadStringCompletedEventHandler - results are the same.
Next idea was somehow to capture ajax responses (when certain number is calculated and inserted in the page), because basically that's all I need, the result numbers, but I haven't found any ways to do it.
So, is there a solution to my problem? I forgot to mention that I am trying to code it as a C# project.
|
|
|
|
|
You have been advised to use the ASP.NET forum previously for AJAX questions:
http://www.codeproject.com/Messages/3179251/Re-AJAX-Csharp-and-webpage-source.aspx[^]
The other thing is, getting the values from AJAX based pages isn't any different from normal, unless you have done something out of the ordinary. I suggest you find a good beginners book on this stuff.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Hi,
I have a PictureBox inside a Panel control, the Panel being used to obtain scrollbars for the PictureBox. Having come from Delphi I can't work out a way to make the scrollbars update the position of an image in the PictureBox while the mouse drags the scrollbars (it only updates after the mouse is released).
IIRC with Delphi it was easily done by changing a couple of properties in a TScrollBox component. Does this have to be done manually in the Scroll event handler? Or would it be better to create my own scrolling control for this?
Thanks,
Dave.
|
|
|
|
|
you can also try div for this.
|
|
|
|
|
Best wishes,
Navaneeth
|
|
|
|
|
I assume PictureBox automagically handles the scrollbar's ValueChanged event. For smoother response, I expect you'll need to handle Scroll [^].
/ravi
|
|
|
|
|
I am using the following to save and use public variables:
<pre>private static int? _system_id;
public int? system_id
{
get { return _system_id; }
set { _system_id = value; }
}
</pre>
but now I have many fields from my system_parameters sql server table and i want to save it as public variable.. is it possible to get the field name as public variable name and field value as public variable value so it can be created at run time?
|
|
|
|
|
Probably create a separate class to hold the values or perhaps use a Dictionary to store them.
Basically, as I told you yesterday[^].
|
|
|
|
|
yup...
I knw about yesterday but I just wanted to know how to create it at run time instead of creating at design time..
|
|
|
|
|
Without resorting to codeDOM and dynamically generating code or an assembly, there is no way to create a variable or property at runtime.
You could use a hashtable.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
well, i was thinking of an sql table with the following fields:
system_param_id int (PrimaryKey)
system_param_name varchar(50)
system_param_value varchar(50)
and when logging to the system then it will populate each record with two things:
param_name
param_value
so if I have 100 records in that table then I will have 100 variables..
what's the best method to use?
|
|
|
|
|
Why a database? Would these variables need to be saved from session to session? Where do they come from in the first place. A simple Hashtable stored in a static variable may be all that's necessary.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Well Im completly agree with PIEBALDconsult.
Use either dictionary or hashtable object to store all parameters as key, value pair.
This will be much easier to maintain as well as you have only one public variable.
|
|
|
|
|
how can I have the hashtable as public? I tried the following but not working!
my public class is:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace cure_hospital_management
{
class public_class
{
private Hashtable _sysem_parameters;
public Hashtable sysem_parameters
{
get { return _sysem_parameters; }
set { _sysem_parameters = value; }
}
}
}
my code in the mail form load is:
<pre>public_class public_var = new public_class();
private void get_system_parameters2()
{
public_var.sysem_parameters = new Hashtable();
public_var.sysem_parameters.Add("Name", "Jassim Rahma");
}
</pre>
and my code to read the value is:
<pre>MessageBox.Show((string)public_var.sysem_parameters["Name"]);</pre>
but I am getting this error when reading the value:
Object reference not set to an instance of an object.
|
|
|
|
|
u need to call get_system_parameters2() before accessing hashtable.
First follow some guidlines to make it more perfect
1. Move sysem_parameters = new Hashtable(); in public_class class.
2. Check if hasttable is null then create new instance of hasttable in get part of sysem_parameters.
3. Have a look at Singleton pattern
|
|
|
|
|
how can I keep one sql connection alive in my application and use that connection in my all forms? and does it have any disadvantages?
|
|
|
|
|
Your application shouldn't know anything about the database.
Your application should have a business layer. You can pass a reference to the business layer to each form, then they can each use it.
|
|
|
|
|
so you mean i should open and close the connection in every form?
|
|
|
|