|
Thank you for your help.
This code now works perfectly, i can use it on the other group boxes on the form too.
if (rbDraw.Checked == true)
{
foreach (Control ctrl in gbShape.Controls)
{
if (ctrl is RadioButton)
{
RadioButton rb = ctrl as RadioButton;
if (rb.Checked == true)
{
imageViewer1.ShapeSelected = (FileScroller.ImageViewer.Shape)rb.Tag;
}
}
}
}
Thank you again
George
|
|
|
|
|
I have a windows app in which I want to open a text file in Notepad. When a button is clicked, a file dialog must open which lets the user select a file to be opened in notepad. I know how to create an OpenFileDialog, but I don't know how to open the selected file in Notepad. How does one do this?
|
|
|
|
|
Check out the Process class in the System.Diagnostics namespace.
You should create a Process object, set its StartInfo properties to launch notepad and open your selected text file. Something like this.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"C:\Windows\notepad.exe";
p.StartInfo.Arguments = @"C:\yourPath\yourTextFile.txt";
p.Start();
|
|
|
|
|
Process.Start(filename) opens the file in its default application, as if you double-clicked it in Windows Explorer.
|
|
|
|
|
Any idea how to do this in ASP.NET?
|
|
|
|
|
hi
I wanna truncate all data in data base
The problem in delete forign key
how i can do that????
|
|
|
|
|
1. Wrong forum.
2. See this[^] link.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
|
Hi,
Firstly I am currently a Project Manager so I don't have the detail I would probably have if this was an Open Source issue which I am more familar with. Anyway enough of the caveats.
My understanding is the team create Proxy Classes using WSDL.exe. These classes and then cut and paste into other code which uses them. Please please please don't ask why, accept it does and if you are still reading read on.
What I want to know is,
Does anyone know of any code which could be used to automate this. I was thinking, project managers can, that a pre-compiler of some sort could solve this.
E.g. in the source which need to have the pasted code you could have.
// #AUTO_GENERATED_SOURCE_FILE:Auto_GeProxy_Class.cs #FUNCTION_TO_COPY:My_Foo()
Then make a tool which pre-processing this appropriately.
People are using VS2008
Thanks for listening.
|
|
|
|
|
They need to generate the new proxy class only when there is some change made in the service. Now, since they will be having existing old proxy class, they can use /out or /o switch to directly write the new class to the mentioned location. Like this:
wsdl [service url] /o [file where to write the proxy class]
Is this what you are looking for?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi,
Firstly thanks for replying.
I think the original is a code management one. As I said I don't have the detail behind why they are where they are. I think but don't know, that they have some common functions which are split across various projects. They generate the proxy classes and need to ensure all services have these new generated types. I believe they new some of the code a function level to be copied into the other projects.
I have googled for cut and paste from proxies and it does seem that there are few people fallen into this trap in one way or another.
Regards,
Iain
|
|
|
|
|
1. If they are merely adding the new parts of the proxy class to the old one, I would say please don't do it. You might miss out something and it will spoil entire application. Replace the entire proxy class.
2. Say the service had a method Sum which took in "int x" and "int y" as parameters. Later, they changed it to give the sum of three numbers and hence added "int z" as a parameter. Now, they need to change all the calls for the method in the client. Here, there is not much of chance, IMHO, of automation. I am saying so since in your application, the might or might not be as simple as my example. Also, you never know what will be the next change. You also don't know how the clients have consumed the method. If all the consumption ways are different, it will not be an easy task to automate.
If you can clarify what exactly is copied and pasted, maybe someone could give a better response. For now and from my understanding, I don't see much of an automation here.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Iain Wiseman wrote: I think but don't know
We have a saying where I work: "There is no thinking allowed. You either know, or you need to go find out. Thinking only results in misunderstandings and huge bugs."
But, I agree with the other poster. This sounds like a very kludgy way of updating the web service interfaces.
Nothing personal, just my two cents...
|
|
|
|
|
I want to select "FullName","EmployeeNumber" from the datatable 'results' ..The selection should be based on some conditions like date=some date....Can anybody tell how to achieve this???
|
|
|
|
|
Datatable has a method Select which does what it says but I am not sure whether it allows filtering or not. If I remember correctly you can use DataView to filter data.
|
|
|
|
|
If you are using .Net 3.0 or above, LINQ is your friend. Otherwise, you can use DataTable.Select method to get the rows which fulfill the conditions and then extract the name and employee numbers from them.
If this is a one time activity ie conditions are pre defined and well known, the fetch only the data that confirms the conditions. You can have a stored procedure which can take the date values as parameter and then return the records.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Try
objTable.Select("date='some date'");
|
|
|
|
|
hi every body,
in my application i want to retrieve image from database and it will show on picture box, so my code is
try
{
int no = int.Parse(textBox2.Text);
SqlConnection con = new SqlConnection("user id=sa;password=sa123;server=192.168.0.44;database=eswar");
SqlCommand cmd = new SqlCommand("select imagedata from image1 where sno=" + no, con);
//byte[] barrImg=(byte[])cmdSelect.ExecuteScalar();
cmd.Parameters.Add(textBox2.Text, SqlDbType.Int, 4);
cmd.Parameters[textBox2.Text].Value = this.textBox2.Text;
con.Open();
byte[] imgarr = (byte[])cmd.ExecuteScalar();
string strfn = Convert.ToString(DateTime.Now.ToFileTime());
FileStream fs = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write);
fs.Write(imgarr, 0, imgarr.Length);
fs.Flush();
fs.Close();
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
pictureBox1.Image = Image.FromFile(strfn);
cmd.Dispose();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
when my application is running it will shows a out of memory exception
pls help me
thanks in advance.........
|
|
|
|
|
First, comment out your try catch block, and then look at where it does happen.
Second: Put your code into <pre></pre> blocks
|
|
|
|
|
see my sig.
and use Exception.ToString() not Exception.Message
|
|
|
|
|
hi bros,
I've a problem when call the below Lotus Notes API function
STATUS LNPUBLIC NSFItemAppend(
NOTEHANDLE note_handle,
WORD item_flags,
char far *item_name,
WORD name_len,
WORD item_type,
void far *item_value,
DWORD value_len);
In C# I use platform invoke as below:
using DWORD = UInt32;
using HANDLE = IntPtr;
using STATUS = UInt16;
using WORD = UInt16;
...
[DllImport("nnotes.dll")]
public static extern STATUS NSFItemAppend(HANDLE note_handle, WORD item_flags, String item_name, WORD name_len,WORD item_type, HANDLE item_value, DWORD value_len);
The problem is that I don't know when I call it, how can I pass a pointer (HANDLE) of types such as string, TIMEDATE.. into the function.
I've thought of item_value with System.Object type but it does not help.
Please help me with this case, I really need it.
Many thanks.
|
|
|
|
|
Hi,
is this the first P/Invoke call you are trying? or are there others that succeed/fail?
You should build it up, trying the simplest methods first.
Make sure to put all the P/Invoke stuff in a big try-catch and have the catch block show the full Exception.ToString()
If you don't need note_handle on the managed side (i.e. it gets a value returned by your first Lotus call, then needs to be passed to consecutive calls), then an IntPtr is fine.
Is item_value an input? or an output?
Passing a string as input is easy, just use string ; you may want to add CharSet=CharSet.Ansi or CharSet=CharSet.Unicode to the DllImport attribute.
Passing a pointer to a number, an array, a struct takes some effort, as you must make sure the object can't get moved by the GC while native code is using it. I tend to use the GCHandle class for that, although simple cases can be solved using the fixed keyword.
BTW: I am preparing a couple of articles on P/Invoke; here[^] is a preliminary version for part 1, that might be useful.
|
|
|
|
|
Hello Everybody,
I want to create multicast delegates automatically. I am working on a solution with Attributes on methods. The plan is to have a method, that takes a few objects and creates a multicast delegate from all methods that have a certain Attribute.
In the following example I want the method ConformsToMyMulticast to be added to the multicast (because it is marked with MyAttribute).
class Program {
public delegate void MyMulticast();
static void Main(string[] args)
{
MyMulticast multi;
Test t1 = new Test();
MethodInfo[] methodList = t1.GetType().GetMethods();
foreach (MethodInfo info in methodList)
{
foreach (object o in info.GetCustomAttributes(true))
{
if (o is MyAttribute)
{
multi += info ???
}
} } }
}
class Test
{
public Test() {}
[MyAttribute()]
public void ConformsToMyMulticast() {}
}
I've been working on that for the last few hours and I really hope one of you can help me.
Thanks in advance!
|
|
|
|
|
Work with Delegate.CreateDelegate() and Delegate.Combine methods.
MyMulticast multi = delegate { };
Test t1 = new Test();
MethodInfo[] methodList = t1.GetType().GetMethods();
foreach (MethodInfo info in methodList)
{
foreach (object o in info.GetCustomAttributes(true))
{
if (o is MyAttributeAttribute)
{
Delegate d = Delegate.CreateDelegate(typeof (MyMulticast), t1, info);
multi = (MyMulticast) Delegate.Combine(multi, d);
}
}
}
multi();
Best wishes,
Navaneeth
|
|
|
|
|
It works \(^_^)/
Thank you very much.
I had experimented with Delegate.CreateDelegate , but I always got an ArgumentException .
|
|
|
|