|
Thanks for the help,
It works now for all of the keys except the arrow keys and tab key. Is there any way to have it run the keydown function when the arrow keys are pressed instead of jumping between the radiobuttons?
Matt
|
|
|
|
|
Sure, read up on ProcessCmdKey and IsInputKey
|
|
|
|
|
Hi, I'm trying to bind a lookup table to a comboBox. Well the contents of the ComboBox binds ok, but the binding on the SelectedValue doesn't work! Here's my code:
DataTable table = new DataTable();<br />
table.Columns.Add("Name", typeof(string));<br />
table.Columns.Add("Value", typeof(int));<br />
for(int i = 0; i < namesArray.Length; ++i)<br />
{<br />
table.Rows.Add(new object[] {namesArray[i], i});<br />
}<br />
<br />
combo.DataSource = table;<br />
combo.DisplayMember = "Name";<br />
combo.ValueMember = "Value";<br />
<br />
combo.DataBindings.Add("SelectedValue", dataset.LoadModule, "MyColumn");<br />
<br />
numericUpDown1.DataBindings.Add("Value", dataset.LoadModule, "MyColumn");
What am I missing? This is going to drive me nuts!!!
|
|
|
|
|
I am thinking that you may have a sorting problem. Do you have the combo box sort set to accending or decending. If so I think that is your problem. Try the following after adding all the rows...
table.DefaultView.Sort = "Name";
combo.DataSource = table.DefaultView;
Chris
|
|
|
|
|
Also make sure you set the sort on the combobox to none.
|
|
|
|
|
If that doesn't work then try combo.DataBindings.Add("SelectedValue", table /*or dataset.Tables["MyTableName"]*/, "Value");
|
|
|
|
|
Thank you for the help! Now the right item is selected, but when I change it, it doesn't change the data source!
For example:
private void myCombo_SelectedValueChanged(object sender, System.EventArgs e)<br />
{<br />
MessageBox.Show(dataset.LoadModule[cm.Position].MyColumn.ToString());<br />
}
In this code above, the MessageBox always displays '5', which is the initial SelectedValue.
I'm really having a hard time with this!
|
|
|
|
|
I dont have much experience with a currency manager. I am guessing the same datatable isn't getting bound to the currency manager. How are you binding the code to the currency manager?
|
|
|
|
|
I use the CurrencyManager because its Position property represents the index of the current record being viewed. FYI this is how I use it and it works fine:
cm = BindingContext[dataset.LoadModule] as CurrencyManager;<br />
dataset.LoadModule.DefaultView.Sort = "SerialNumber";<br />
cm.Position = dataset.LoadModule.DefaultView.Find(serialNumber);
But this is not a CurrencyManager issue, since the program gives me the right value (5), it just doesn't update it!
|
|
|
|
|
AFAIK there is no ComboBox.SelectedValue
did you mean SelectedText ?
|
|
|
|
|
This should be pretty easy but I'm having so many problems with it.
I'm following someone elses code and cant figure out how he did this.
One of the webmethods returns 3 parameters and it uses a class of somesort to do it. We had to reverse engineer to get the code so its not complete.
[WebMethod]
Public Class1 HelloWorld(int i1, string str1, string str2)
{
try
}
//Code
}
Catch
}
return Class1(1,2,3)
}
{
return Class1(0,0,0)
}
}
How is this possible? Thanks in advance.
|
|
|
|
|
why would it not be possible ? Importing a web service will import the types it exposes, including enums and classes.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm sorry I guess I wasnt clear. I get this error when i try to build.
'Service.Test222(string, string, string)' is a 'method' but is used like a 'type'
|
|
|
|
|
Oh, OK. The code looks wrong to me, shouldn't say return *new* Class1(x,y,z); ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It looks as though it's one of two options. Either the Class1 mentioned in the catch/finally block refers to a method on the web service which returns an instance of Class1, or you are missing a new statement on the return Class1 constructor.
|
|
|
|
|
I guess my real question is how to make class1 work as a type. When i put class1 in front of Hello world I get an error. How do i declare/create it so I can use that class1 type
|
|
|
|
|
It should exist as webserviceNamespace.class1. Can you see it declared in the code created when you import the webservice ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You are getting me closer. Again I appreciate it. Here is my exact code(I've simplified it). If i want to return those three arguments what do i have to do?
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Class1 : System.Web.Services.WebService
{ }
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public Class1 Hello() {
return new Class1("1","2","3");
}
}
|
|
|
|
|
You are close, now you need to provide an overloaded constructor for Class1 to take your 3 string arguements. It would look something like this:
public class Class1 : WebService
{
public Class1(string one, string two, string three)
{
this.one = one;
this.two = two;
this.three = three;
}
public Class1 Hello()
{
return new Class("1", "2", "3");
}
}
|
|
|
|
|
when i run that (see the code below) I get this error. Class1 cannot be serialized because it does not have a parameterless constructor.
public class Class1 : System.Web.Services.WebService
{
public Class1(string strOne, string strTwo)
{
strOne = strOne;
strTwo = strTwo;
}
[WebMethod]
public Class1 HelloWorld(string str1, string str2)
{
return new Class1(str1,str2);
}
}
|
|
|
|
|
brsecu wrote: when i run that (see the code below) I get this error. Class1 cannot be serialized because it does not have a parameterless constructor.
Just add a default constructor as well that has no parameters:
public class Class1 : WebService
{
public Class1(){}
public Class1(string s1, string s2, string s3)
{
}
}
|
|
|
|
|
Thanks for your patience with me.
OK i did that and it builds but now I get this error:
Cannot serialize member System.ComponentModel.MarshalByValueComponent.Site of type System.ComponentModel.ISite because it is an interface.
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
namespace WebService1
{
///
/// Summary description for Service1
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Class1 : System.Web.Services.WebService
{
public string _strOne;
public string _strTwo;
public Class1()
{
}
public Class1(string strOne, string strTwo)
{
this._strOne = strOne;
this._strTwo = strTwo;
}
[WebMethod]
public Class1 HelloWorld(string str1, string str2)
{
str1 = "1";
str2 = "2";
return new Class1(str1,str2);
}
}
}
|
|
|
|
|
thanks to all who help...
1)How do i read a 2 byte, 4 byte, or 8 byte value? I know how to read a one byte, but that only goes up to 255...
2)If any of you are familiar assembly, i need know now how to change (write) to an addresses hex dump, also known as Array of Byte (in most memory editing engines).
3) Reading/writing to a pointer I.E (0x1009624, offset: 0xb14), or any other pointer...
thanks in advanced
|
|
|
|
|
What does this relate to ? Where are you reading from ?
pointers are easy, you just create an unsafe block, and you can manipulate them, as if they are an array.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
1)
Code:
ProcessMemoryReaderLib.ProcessMemoryReader memedit = new ProcessMemoryReaderLib.ProcessMemoryReader();
memedit.ReadProcess = myprocess[0];
memedit.OpenProcess();
int bytesread; //needed
int byteswritten; //needed
int address = 0x1009624; //address
int value; //value of address
short value2=444; //for writing 2 byte, 444 for the value
byte[] memory; //for reading byte reading
memory = memedit.ReadProcessMemory((IntPtr)address, 1, out bytesread); //starts out as a byte array...i'm wondering how to get around this...
value = memory[0];
MessageBox.Show(value.ToString());
//writing memory =
BitConverter.GetBytes(value2);
memedit.WriteProcessMemory((IntPtr)address, memory, out byteswritten);
As you can see, when you read an address...the value is assigned to a byte array, how do I get around this? Like if I want to read a 4-byte value.
2) I need to be able to make a IntPtr pointer to an address with an offset, aka a pointer...should be simple but i can't figure it out...
3) I need to be able to edit or change the hex dump of an address, for example... lets say the hex dump of an address is 8f 00 00 00 ae 00 3f or something, i need to be able to change it to 8f 01 00 00 00 ae 00 3f. That's just an example...thanks in advance.
|
|
|
|