|
I've had this problem before. I don't know WHY it surfaced... It seems that a process has hold of the libdll file, so it can't be overwritten.
When I see this problem, I close down VS.net, remove libdll from the folder that mainexe is compiled into.
When I startup VS.net and open the project again, I don't see this problem again.
|
|
|
|
|
Sounds like a very similar problem we just had yesterday. We had one session running to modify the dll library. The second session was running the main program that referenced the dll library. Every time a change was made to the library, the debugger would no longer work on the dll library code. We tried several things and after being frustrated with shutting down the code several times, we found the following solution.
Solution: Make the appropriate change to the library code and build the source. Go to the main application, remove the reference to the dll and then re-add it. It takes about 10 seconds to do, it is tedious, it is senseless that it has to be done, but it worked! We were successful in completing the debugging in a reasonable time.
db
|
|
|
|
|
Hi Everyone -
I am trying to create a C# wrapper around a legacy C .DLL
I am stuck on one implementation area...
There is a DLL function called GetDateTime
extern "C" bool GetDateTime( DateTimeStruct &dateTime )
is how the SDK says it is to be implementated.
I have created a wrapper shell for this function below...
[DllImport("CarChipSDK", EntryPoint="GetDateTime")]
public static extern bool GetDateTime
(
//// what goes here???
);
I have create the struc in BOTH the main program,
and the shell
[StructLayout(LayoutKind.Sequential)]
public struct DateTimeStruct
{
public int year;
public int month;
public int day;
public int hour;
public int minute;
public int second;
}
Here are the questions...
1) Do I need to create a struct in both the caller and callee classes?
2) How do i setup the caller class to send the struct to the callee class?
thanks
tony
|
|
|
|
|
I haven't done this before, but have been researching for my own project. This is how I think it should work...
define the struct in your "callee" class namespace:
<br />
namespace myNS<br />
{<br />
[StructLayout(LayoutKind.Sequential)]<br />
public struct DateTimeStruct{...}<br />
<br />
class Callee{<br />
[DllImport("CarChipSDK", EntryPoint="GetDateTime")]<br />
public static extern bool GetDateTime <br />
(out DateTimeStruct dateTime);<br />
}<br />
}<br />
in "Caller" add MyNS as reference, add new DateTimeStruct variable and then call your function, passing this variable by reference:
<br />
using MyNS;<br />
...<br />
DateTimeStruct dts;<br />
...<br />
Callee.GetDateTime(out dts);<br />
...<br />
int hr = dts.hour;<br />
Let me know if this works.
Tym!
|
|
|
|
|
I don't why I'm getting this exection. No idea what does
this mean.
Here is the code :
In this CollectionFactory is for creating a new instance
for VBA collection because we cannot use new on VBA
collection outside VB.
CollectionFactory.clsVBACollectionClass Col = new CollectionFactory.clsVBACollectionClass();
VBA.CollectionClass mHoliDates = (VBA.CollectionClass) Col.CreateVBACollection();
System.Collections.IEnumerator e = oAdsCollection.GetEnumerator();
while( e.MoveNext() != false )
{
IADSObject oAdsObject = (IADSObject)e.Current;
DateTime dt = (DateTime) oAdsObject.GetValueByIndex(0);
object oValue = (object) oAdsObject.GetValueByIndex(0);
object oKey = (object) dt.ToString("mm/dd/yyyy");
mHoliDates.Add(ref oValue, ref oKey,ref oMissing,ref oMissing);
}
if I'm commenting following line in code above then I'm
not getting any exception
mHoliDates.Add(ref oValue, ref oKey,ref oMissing,ref
oMissing);
mHoliDates is a VBA.Collection.
oAdsCollection is COM collection written in MS VC++
And I'm getting exception on this line
while( e.MoveNext() != false )
|
|
|
|
|
One cannot modify a collection while enumerating thru it. You will have to look for another solution.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
But I'm not enumerating thru same collection. I'm enumerating thru oAdsCollection which a c++ com collection and trying to modify VBA Collection mHoliDates.
I'm getting exception on while( e.MoveNext() != false ).
|
|
|
|
|
Sorry I miss read that a bit, I think you will need to copy your references perhaps.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
As leppie says, you can't modify a collection while enumerating through it. My suggestion is to add the items to a separate collection, and then add them all at once after you're out of the foreach loop.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I found the problem. My data was wrong I was adding duplicate Keys in my VB collection
|
|
|
|
|
|
|
|
1. In the code below I refine an array and add two properties to it. I can add elements to this array but can not read them back.
public class C_myList : System.Collections.ArrayList
{
public C_myList()
{
}
public void Add(string sString, int iNumber)
{
m_sString = sString;
m_iNumber = iNumber;
base.Add(this);
}
//refine the arraylist by adding two properties
public int m_iNumber;
public string m_sString;
}
2. Now I would like to add some items to this array and read them back. I can add them but what is the syntax for reading them back?
private void button1_Click(object sender, System.EventArgs e)
{
C_myList aList = new C_myList();
for(int i=0; i < 20; i++)
{
aList.Add(i.ToString(), i * 2 );
}
/*for(int x =0; x < 5; x++)
{
int ivalue = xList[x];
int ivalue2= xList[x].m_iMajorTabOrder;
}*/
}
thanks
|
|
|
|
|
are you sure your code is correct?
what is the intention of base.Add(this) ?
eperales
|
|
|
|
|
make life easy for yourself. store the information in a struct, then use ArrayList to store an array of structs.
To those who didn't make it, we will remember you. To those who did is back. - Megan Forbes in Black FridayAnother Post by NnamdiOnyeyiri
|
|
|
|
|
There is VSS in Visual Studio 6.0. But I can't find it in Visual Studio .Net
Anyone know why?
Thanks in advance.
|
|
|
|
|
Its there. Check your file_Sourcecontrol menu. and check your Tools_options_sourcecontrol menu.
Installer is probably in 3rd or 4th CD.
You will be needing atleast VSS 6.0c to work with .NET.
Regards.
NetPointer
|
|
|
|
|
You can alternatively use Borland's Starteam Personal Edition. It has VS.NET integration.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
i need to have all the names of the textboxes on my form put into an array. is there a way to dynamically set up an array of all the textboxes on my form?
Thanks,
.gonad.
|
|
|
|
|
You can get controls in your form by this.Controls property in your form,then check the type of each one and if it is TextBox put it in an array.
Mazy
No sig. available now.
|
|
|
|
|
Let me give you a few clues. I am new at this so bear with me.
1. Read through all controls on the form, like this
..
private ArrayList m_VisibleList = new ArrayList(); //poor name, it is all controls not just visible ones
...
public void BuildListOfAllControlsOnForm()
{//build a list of all controls on the form
m_VisibleList.Clear();
m_VisibleList.Add(this);
ArrayList aPendingControlListTemp = new ArrayList();//used to avoid
aPendingControlListTemp.Add(this);
System.Windows.Forms.Control CtrlParent = null;
System.Windows.Forms.Control CtrlChild = null;
for(int i=0; i < aPendingControlListTemp.Count; i++)
{//progress thru for loop for the form and any tab pages or frame
CtrlParent = (System.Windows.Forms.Control)aPendingControlListTemp[i];
for(int iIter = 0; iIter < CtrlParent.Controls.Count; iIter++)
{
CtrlChild = CtrlParent.Controls[iIter];
Debug.WriteLine("Parent hash " + CtrlParent.GetHashCode() + " Child hash " + CtrlChild.GetHashCode());
m_VisibleList.Add(CtrlChild);
if(CtrlChild.Controls.Count > 0)
{//tab page or frame control
aPendingControlListTemp.Add(CtrlChild);
}
}
}
aPendingControlListTemp.Clear();
int iCount = 0;
foreach(System.Windows.Forms.Control Ctrl in m_VisibleList)
{
Debug.WriteLine(++iCount + " " + Ctrl.Text );
}
}//BuildListOfAllControlsOnForm
2nd. Loop through your list and ask which are Textboxes, that code would be something like this
...
System.Windows.Forms.Control Traverse; where Traverse would point to an element in VisibleList.
...
if(Traverse.GetType() == typeof(CheckBox) ||
Traverse.GetType().IsSubclassOf(typeof(CheckBox)))
{//do special case handling for check box
System.Windows.Forms.CheckBox pCheck = (System.Windows.Forms.CheckBox)Traverse;
if(pCheck.Checked== false)
{
Traverse.Focus();
break;
}
}
Let me know if this is too much and I will try to refine it for you.
|
|
|
|
|
static void GetTextBoxes(Control parent, ArrayList list)
{
foreach (Control ctrl in parent.Controls)
{
if (ctrl as TextBox != null)
list.Add(ctrl.Name);
GetTextBoxes(ctrl, list);
}
}
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
This should work:
ArrayList names = new ArrayList();
foreach(Control ctrl in myForm.Controls)
{
if(ctrl is TextBox) names.Add(ctrl.Name);
}
I don't need no steenkin' LSD. If I want to see technicolour smears, I just give my daughter pizza for dinner.
-Jamie Hale
|
|
|
|
|
All of the solutions given to you will work, if you just want textbox controls on the "FORM".
But if your form contains tab-controls or frame-controls and you would like to know what/if these containers also contain textbox controls, then I think you need the solution I gave you.
Lastly, if you do not care about textbox controls nested inside tab pages that are not active you could use GetNextControl().
Here is an example.
public void SetFocusOnFirstEmptyControl()
{
int iCount=0;
System.Windows.Forms.Control Traverse = this;
//System.Reflection
while(Traverse != null)
{
Debug.WriteLine(++iCount + " " + Traverse.Text );
//myChild.GetType().BaseType.Equals(typeof(myFatherClass))
if(Traverse.GetType() == typeof(CheckBox) ||
Traverse.GetType().IsSubclassOf(typeof(CheckBox)))
{//do special case handling for check box
System.Windows.Forms.CheckBox pCheck = (System.Windows.Forms.CheckBox)Traverse;
if(pCheck.Checked== false)
{
Traverse.Focus();
break;
}
}
if(Traverse.Text.Length == 0)
{//test controls like textbox and dropdown
Traverse.Focus();
break;
}
Traverse = GetNextControl(Traverse, true);
}//while
}//SetFocusOnFirstEmptyControl
You have a lot of good people helping you. An answer is assured.
|
|
|
|