|
I think this is idd your problem. You'll need to fetch the instance already open.
Easier would be that your C# loads up, creates the VB Form for you and shows it. That way your variable has been set up in the C# project and is immediately accessible.
Hope this helps.
IOW
ProjectVB.Form1 f1 = new ProjectVB.Form1;
f1.ShowDialog();
f1.ChangeLblFunction();
|
|
|
|
|
Yes, the "new" is causing your problem, since it create a new instance of the VB form.
One of your two projects will be the Startup Project. In that you will be creating an instance of the other - or it wouldn't be displayed. Whereever you create and display the other form, save it and you can access it later.
So, if your startup project is C#, somewhere you will be saying:
ProjectVB.Form1 f1 = new ProjectVB.Form1;
f1.Show();
You can save the value as a class variable, and then call the Fnc_ChangeTxt method in your button handler.
If your startup project is VB, there will be similar code to show the C# form - You can hand it the instance of your VB form and store that as a C# class variable.
The better way to do it would require changes in the same area - create an event in the C# which you throw in your button event, and subscribe to in your VB form. This means that the two projects are more independant of each other.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
In your C# app, do something like this:
public partial class MyForm
{
private VBFormProject.VBForm m_vbForm = null;
private void clickHandler(object sender, EventArgs e)
{
if (m_vbForm == null)
{
m_vbForm = new VBFormProject.VBForm();
}
m_vbForm.Show();
m_vbForm.Fnc_ChangeText("some text");
}
private void OnClosing()
{
if (m_vbForm != null)
{
m_vbForm.Close();
}
}
}
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Every EventLog entry my application makes ends with the following string:
"For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp."
I know there is a way of removing or replacing this, I just can't seem to find it!
Regards!
|
|
|
|
|
Hi, someone knows a program to calculate the polynomial for CRC value?
I have the string example "100140590201004d000b00014b2b877053b17ee9100305ee5a" and the, i think, CRC value "7579d418" but i don't know the CRC polynomial.
I wait for suggestions.
Best regards and merry Christmas.
Andrea
|
|
|
|
|
|
Hi,
kindly let me know that, how may I change following datagridview font and size setting? coz, following commands are not working:
dataGridView1.Font.Name = "Vardana";
dataGridView1.Font.Size = 10;
thank you in advance
(Riaz)
|
|
|
|
|
You cannot modify the font's type since it is ReadOnly, you should replace it with a new font.
A simple way to change the Font:
dataGridView1.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular);
If you MUST use Verdana, you need to get a reference to it's FontFamily first, this is a little more code:
FontFamily[] ff = System.Drawing.FontFamily.Families;
FontFamily myFF = null;
foreach (FontFamily f in ff) {
if (f.Name == "Verdana") {
myFF = f;
break;
}
}
dataGridView1.Font = new Font(myFF, 10, FontStyle.Regular);
PS. I believe there are better ways to get to the FontFamily, perhaps using LINQ, anyone here may improve on this.
Merry Christmas
|
|
|
|
|
Hi,
we build a kernel mode dll which we want to access via C#! The kernel mode dll is called "sample.sys" and is an export driver. I tried to access the export (functions) with the dllimport statement from C#.
[DllImport("Sample.sys",
CharSet = CharSet.Auto,
CallingConvention = CallingConvention.Winapi)]
public static extern uint FindAll();
The definition from the dll and the function in the testing project ("FindAll") are the same. I also tried with the complete path to the export driver. The "Sample.sys" is located in the running directory of the C# testing assembly.
I always get a AccessViolationException ("attempt to read or write protected memory")
Does anybody know how to access this functions from C#?
|
|
|
|
|
This may be so obvious as to be a dumb question, but are you running this test under an Administrator or System account? Kernel mode functions, and the memory they use, are carefully protected from users, for good reason.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I run it as local Administrator
|
|
|
|
|
i hv problems below:
a = 123456.789
b = 7
c = a/b --> the result is 17636.6841
but i want it shows 17636 (not rounding to 17637)
can anyone helps???
thx,
cool-a
|
|
|
|
|
There are a lot of solutions to your problem, but you didn't tell us whether or not you're displaying the number, or merely want to omit the fractional part from further calculations. Assuming you just want to display, it, do it this way:
string cString = Convert.ToInt32(c).ToString();
If you want to change the actual value, you can use Math.Floor, or even Convert.ToInt32 (I think).
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Review the "Math" library. There is a "Floor" and "Ceiling" function. Ceiling rounds 1.1 to 2 and Floor makes 1.9 to 1.
You will need to make sure a and b are "double" but will be fine.
double a = 123456.789;
double b = 7;
double c = Math.Floor(a/b);
|
|
|
|
|
thx all... it helps me lot
|
|
|
|
|
When the CheckedChanged event fires, why does e not have a property with the current state? A CheckedListbox does...
Am I missing something here?
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)...
>>e has 'currentValue' and 'newValue'<<
private void checkBox1_CheckedChanged(object sender, EventArgs e)...
>>e has doesn't<<
Do I really have to go get the state from the checkbox when I'm already in the state event fired by that checkbox?
(checkBox1 == true)
That seems redundant. Thanks.
|
|
|
|
|
BDJones wrote: Do I really have to go get the state from the checkbox
yes
BDJones wrote: if (checkBox1 == true) ...
no
if (checkBox1.Checked) ...
|
|
|
|
|
|
The reason the checkedlistbox passes the state is because there are any number of individual checkboxes which may be checked/unchecked. A single checkbox is passed to you in the event
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkBox = (CheckBox)sender;
if(chkBox.Checked) ...
}
|
|
|
|
|
|
Would you mind educating me a little more...
What exactly is happening here? (Checkbox)sender;
Is this casting sender as a Checkbox?
|
|
|
|
|
How can I add DLL file to RichTextBox ?
|
|
|
|
|
dataminers wrote: How can I add DLL file to RichTextBox ?
Que? Like an OLE-object or what? Do you want to call methods in it during the viewing of the RTF, or should it represent data in the same way that you embed a wave-file?
I are Troll
|
|
|
|
|
I've been working with Visual Studio as hobbyist for a few years, but I only discovered this today. The way I found out was by moving some methods to another class. One of the methods used a Point class (of the System.Drawing namespace), but I didn't add a using-directive for that namespace. Then when I wanted to pass an instance of the Point class to that method from another class (which did have the directive to System.Drawing), it told me I was passing the wrong type.
That's when I discovered I forgot the using-directive to System.Drawing in the codefile of the method that also used the Point class. However, Visual Studio never warned me for that. Although the type I defined for that parameter was completely non-existing, it didn't mark it. Even if I said the parameter should be of type "sldhfsdf", which didn't exist at all (no directive to a potential namespace could have solved that), it still didn't mention anything, and acted as if it was an existing type. I could even use the parameter in the method, and it would propose it in the IntelliSense list.
Only I try to compile, it does return an error.
To clarify, here's an example that seems to be alright to Visual Studio's error checking.
public class Test
{
public void MyMethod(abcabc var1)
{
var1 = null;
}
}
While writing this piece of code, Visual Studio won't tell me this is wrong. The only way to find out is by compiling, or calling the method somewhere so it would tell me I'm either passing an unexisting or invalid variable.
Both Visual Studio 2008 and 2005 seem to do this. Could anyone explain me why this is the case?
|
|
|
|
|
I think you have to tell intellisense to check parameters.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|