|
This should work if you're struct is correct.
eNDIS_802_16E_STATE NDIS_802_16E_STATE interopStruct = new eNDIS_802_16E_STATE NDIS_802_16E_STATE();
bool result = WiMAXGetState(ref interopStruct);
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)
|
|
|
|
|
That looks fine for simple structs, holding value types only, except maybe for padding and different semantics (long and char). And it could go terribly wrong when the struct holds reference types or pointers.
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.
|
|
|
|
|
Of course, with no info on the struct it's impossible to be absolutly sure!
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 all,
I want to create controls dynamicly on a form with the properties comming from a DataTable. (see code below)
The Table contains the infos like "name", "typ", "location", "size", ... of each control to create.
...
adapter.SelectCommand.CommandText = "SELECT * FROM controls WHERE controls_ID = 123";
adapter.SelectCommand.Connection = conn;
adapter.SelectCommand.CommandTimeout = 60;
DS = new DataSet();
adapter.Fill(DS,"Ctrl");
System.Windows.Forms.Control[] X=null;
Table = DS.Tables["Ctrl"];
if(Table.Rows.Count>0)
{
this.SuspendLayout();
for(int i=0; i<Table.Rows.Count; i++)
{
DataRow row = Table.Rows[i];
Type typ = Type.GetType(row["typ"].ToString());
typ X[i] = new typ();
X[i].Text = row["text"].ToString();
X[i].Name = row["name"].ToString();
this.Controls.Add(X[i]);
}
this.ResumeLayout();
}
...
how can I assign or create the right type of control. (see the marked row)
Is there an other way to do that ?
Thank you for your help
frank
|
|
|
|
|
Hi,
there are at least two ways to do it:
1.
for a limited number of types, provide specific code for each type, maybe inside a switch statement; simple but not really elegant.
2.
use reflection, have a look at Activator.CreateInstance()
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 Luc,
tnx for your answer.
Your first way you have mentioned is a way I can follow for that task but, for the future the second solution might be more interesting.
Do you have a link to an example for the second way ?
txn in advance
frank
|
|
|
|
|
No but google will have plenty.
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.
|
|
|
|
|
|
|
Deleted and postedin VB forum
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Hello everyone.. I am new to C#.net. I have got a project similar to MS Word Shape. Where we can add a shape(such as rectangle or circle) and then move it or edit its properties or even delete it. The shape is a control which has 8 little squares (on corners and sides) by which we can resize it.(As i said just like MS Word2007 Shape.) Now I have already made the control move and resize.But i am facing problem with the KeyDown event of the controls. i need it to delete and move the control with the help of keyboard keys. i have already got the Control's Sizechanged, KeyPress and MouseDown events working properly. but only the KeyDown event does'nt work. it seems like this event is never called when any key is pressed.
Yogesh Prajapati
|
|
|
|
|
|
Hi Sameer, thanks for your reply.. I have already tried this long back.. but no use.. i cannot delete my control on pressing Del key.
Yogesh Prajapati
|
|
|
|
|
Hi
I want to write a regular expression that will match when there is no "XXSP" at the begining of the string
eg "XXSPPaabbcc1234" = No Match
eg "XaXSPPaabbcc1234" = Match
Thanks
|
|
|
|
|
Why use a regular expression?
if ((s.Length >= 5) && (!s.StartsWith("XXSP")
{
}
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I need to use a Regular expression (im passing it to a Business rule engine)
|
|
|
|
|
Isn't it just "^XXSP" as in:
string s1 = "XXSPHello";
string s2 = "XaSPGoodbye";
Regex r = new Regex(@"^XXSP");
if (r.Match(s1).Success)
{
MessageBox.Show(s1);
}
if (r.Match(s2).Success)
{
MessageBox.Show(s2);
}
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
That will match any string starting with XXSP.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
You can't use a Regex to not find a pattern, per se, as there are too many ways to not match. Instead you want to match and exclude anything that begins with XXSP.
This should do the trick:
^((X[^X])|(XX[^S])|(XXS[^P])).*$
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
Thanks dude that worked
|
|
|
|
|
I try to use DrawtoImage() to save a usercontrol as a .bmp file,
it fails and only part of the control is displayed and others are just empty.
what is the reason and how to solve this problem?
thanks.
|
|
|
|
|
Hi,
Not sure about UserControls. I do know some Controls don't have a functional DrawToBitmap() method.
e.g. the RichTextBox.DrawToBitmap() documentation says: "This API supports the .NET Framework infrastructure and is not intended to be used directly from your code."
In order to paint such Controls you probably need some P/Invoke. The other day I had to send a FormatRange message (with a hDC and some struct) to get a RichTextBox paint its content to a bitmap correctly.
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.
|
|
|
|
|
...try using a screen grab library.
Regards: Didi
|
|
|
|
|
Hey all
I created a string and assigned a value to it on Form_Load and I want to access this string outside of the Form_Load event handler, like when a user clicks a button on the same form but it never works, and I can't find any help regarding this. Is there a way to do this? Any help would be appreciated, thanks.
---
private void Form1_Load(object sender, EventArgs e)
{
string j = "not working";
}
private void button1_Click(object sender, EventArgs e)
{
j = "maybe...";
if( j == "not working" )
{
MessageBox.Show("true");
}
else { Application.DoEvents(); }
}
---
regards,
jay
|
|
|
|
|
If you both declare and instantiate any field inside a code block, it cannot be accessed from outside that block.
Solution, move the declaration to be a field of the class.
Instead of
private void MyForm_Load(object sender, EventArgs e)
{
string myString = "Fred";
..........
..........
..........
}
use
private string myString;
private void MyForm_Load(object sender, EventArgs e)
{
myString = "Fred";
..........
..........
..........
}
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|