|
Hello
Your post is quite unclear!!
ranandbe wrote: i want to access foxpro database from another database
What do you mean "Database from another database"??
ranandbe wrote: this structure is normal file structure
What structure?? What file?? dbf??
Well, if you want to connect to a Foxpro database -just like any other database- make an OLEDbConnection object with the proper conection string.
look in ConnectionStrings.com[^] for that.
Regards
|
|
|
|
|
Hi thank u for reply,
i have successfully connected the foxpro database through oledb in windows services. but i need the functionality to access the databse from the another one computer(by using services and the same foxpro database). Is this posible if u have a knowledge about this please share with me.
ranandbe
|
|
|
|
|
Hi every one,
I have an application that it is writen by VB.I have anothert application that it is writen by C# and is added to My VB project .I defined some global variables in vb and I'd like to use them in C#,how can I use them?
please guide me .
yours Sincerely,
Orchid
|
|
|
|
|
Hello
Answring your question this way maybe misleading. Some points must be clear first.
1- Does any of your projects compile to a dll?
2- You want to use these global variables at runtime or designtime? -May look obvious, but you must clarify this point-.
3- You said global variables. That means they don't belong o any class?? Why? Forgive my small experience in VB. More details on these global variables would be greatly appreciated.
Regards
|
|
|
|
|
Sooner than expected
For the global variables:
He probably is talking about the variables defined in the main class
(or the class where the main procedure is stored in...)
There are no global variables in the way you usually think of.
(Writing VB isn't different to writing C# except for the syntax and some common tasks which are done differently)
However, i would like to know what he means when talking about global variables too :P
|
|
|
|
|
Hello Mikone .
It's very nice to see you on the forum today.
I've heard that VB still has that global namespace or so where you can declare variables without being belonging to any class. From what you said it looks like it isn't there anymore!!
Extra Regards
|
|
|
|
|
I started googling around to check that and yeah, I am the one who is unexperienced. I started writing vb.net like one year ago and haven't heard of something like a global namespace yet but yes, it exists (Maybe i didn't know about because i try to avoid using global variables )
However, this is what i found:
"The namespace keyword is used to declare a scope. This namespace scope lets you organize code and gives you a way to create globally-unique types. Even if you do not explicitly declare one, a default namespace is created. This unnamed namespace, sometimes called the global namespace, is present in every file. Any identifier in the global namespace is available for use in a named namespace. Namespaces implicitly have public access and this is not modifiable."
As always, i wrote before thinking (yes, this is the wrong order ).
In germany we would call a person like me "Klugscheißer" but i haven't found the correct translation yet :P
That's it for now - sorry for spamming in the forums.
|
|
|
|
|
Hello
mikone wrote: i try to avoid using global variables
That's good. Using global variables is a very poor practice in a high level language. What you do is called Object oriented design as you already know, and it's good.
mikone wrote: i wrote before thinking
I told you missing something doesn't make you a bad programmer, and should not prevent or even lower your contribution rate. If you know something say it. If someone else disagree he/she should post his/her opinion. These are called discussion forums where we all discuss our points of views , and I still like many of you replies.
mikone wrote: sorry for spamming
You didn't, and please don't apologize. I told you earlier we all have our screw-ups -you didn't see mine luckily;P-, and what you do is calld helping not spamming. I'll be eager to read more of your replies.
BTW: Klugscheißer means smart chicken in english!!
Extra Regards
|
|
|
|
|
Dear Nader,
Thanks a lot for your reply,
I think ,I could not describe my question clearly.
In VB project I have a menu that it includs some submenus,I want when every one click on one of the submenue a variable for example "Myflag" in my project be on(for example be true or get a value )and during in VB project and C# project I want to read value of the MyFlag and do some thing with it.
I think this variable(MyFlag)should be global in VB project otherwise I can't use it in other part of VB project."do you agree with me?"
In reply to your question :
1-No ,they don't Compile to a dll.
2-I want to use global variable at runtime.
I like to hear from you.
yours sincerely
Orchid
|
|
|
|
|
Hello
Well, You are talking about inter process communications. This isn't easy, but not immpossible.
There are several ways:
1- Putting the flag in a shared file -doon't forget the locks;)-, accessed by both programs. Something like a config file or a database. Actually I don't like the idea.
2- Putting the flag in a registry key. Again, I don't like it!!
3- The above two solutions were easy. The next one is the best practice, but will need much more work.
Two process -under normal conditions- can't share the same memory block!! Yet, windows applications communicate with each other using messages. This will require:
1- Make P/Invoke calls to the windows API SendMessage() or PostMesage() functions.
2- Make a custom message or choose an exsisting message to carry the data.
3- Grab the handle of the other Form -one way or the other-.
4- Send the message with the possibility of sending an integer as a param.
5- In the receiving Form implement the IMessageFilter interface and catch your message in the PreFilterMessage(ref Message m) method.
If you want to share the same memory block, this will take h*#l more work. I hope you make it!
Regards
|
|
|
|
|
Thank you Dear Nader,
Do you have any sample code or address of link that I can use it ,I think it's better for me.
Best Regards.
Orchid
|
|
|
|
|
Hi,
You can also use .NET Remoting or IPC namespages.
Regards
|
|
|
|
|
Dear ejuanpp,
thanks a lot for your reply,
can you explain more about .Net remoting and IPC namespages because I don't know any about these subjects.
If there are any link about them please introduce me .
yours sincerely.
Orchid.
|
|
|
|
|
Hello
Actually it's IPC namespace. Look for code samples Here[^]
Regards
|
|
|
|
|
Hi,
Thing is that IPC namespace is really poorly documented in msdn. It looks, however, a lot like Remoting
I had to use it very recently, I will send you a few links soon.
Regards
|
|
|
|
|
How to open a dialog where I can browse the files
|
|
|
|
|
System.Windows.Forms.OpenFileDialog myofd = new System.Windows.Forms.OpenFileDialog();
myofd.ShowDialog();
|
|
|
|
|
Hello
Beside what Mikone has already said, I suggest the following if you want to implement file browsing in your Application:
1- You might want to take a look at FolderBrowseDialog class.
2- Populate a TreeView or a ListView with folders using methods provided in Directory class
3- If you want to implement Windows Explorer itself in your application, you can make a WebBrowser control, and set the URL to @"file:\\\C:\" to browse C: drive.
Regards
|
|
|
|
|
Hi All,
I am trying to develop a custom bitmap button, such that i want to make a part of the bitmap as transparent and the remaining part(Which is Non transparent) i want to set it as a button region.
Can anyone suggest me the approach to do that??
This is my first request..Hope i get a reply from someone.
Naveen
|
|
|
|
|
it will be done using gdi+
you can search for code in the above search box
|
|
|
|
|
Hi,
I am not sure whether I understood you correctly or not. You want to make a button which consists of a bitmap which has a transparent and (surprise surprise) a non-transparent area. Now you want that button to ignore the clicks which happen in the transparent area?
If so, you will have a lot of work. Afaik there is no built-in function to support such a feature. You probably have to start writing an own button-class, which inherits from system.windows.forms.control and make it act like you want it to...
So one possibility would be:
- Creating a new button class which inherits from control
- Creating handlers for the controls click events (they have to "judge" whether the click was on a non-transparent or transparent area)
- Using that Control in your projects.
That will be very difficulty but maybe there is an easier solution so just wait for a few more comments :P
Good luck,
mik
*edit* If you just want to make the button clickable (also will raise click event when the transparent area was clicked) you could take the "normal" button control and put the picture on it (picture property) - you could then turn off borders and stuff (just play around a bit with the properties). Doing so would result in the required button BUT it would also raise the click event if you click on the transparent area...
|
|
|
|
|
Hello
What Mikone said is right. You have to make your own class and inherit it from Button class. I only wanted to remind you that if you want to make your BackColor as transparent, don't forget:
1- In your class to call SetStyle(ControlStyles.SupportsTransparentBackColor) protected method to allow transparent BackColor.
2- Then make a new public event Call it for example SelectiveClick .
3- Make the original Click event as protected, handle it and then check for mouse position in the client area if it is within the transparent area or not. This is a very tricky part!! be careful that your image is not constant, you'd have to retreive the pixel at which the click was fired, and check if it has RGB value or not.
good Luck
PS.
If you want to make things easy for yourself, I suggest searching the articles for a button that already implements transparency.
Regards
|
|
|
|
|
Dear friends,
I want to traverse the metadata information of a database. For example, i've a database and i want to list all the user tables in that databse. Also, for each table, i want to list all the columns of the table. Similarly, for each column, i want to determine whether it is a primary key or a foreign key. I also want to determine constraints information.
What is the best method to do so in .NET ?
Imtiaz
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|
|
The time that I write code is not long, so I always confuse about what format should be the best for a procedure. In a case, if you write the code with the general thinking, maybe in the procedure it will have some repetitious use of some judge conditions or the calling of a sub_function. If you do this procedure with a unusual thinking, maybe the procedure can avoid the repetitions use. But ,it will make other people who read your code not quitely easy to understand. In this case, What way to write the code is the best one?
Following is my code of Drag&Drop for two listBox. The fucntion is :when two listbox in a form, user can drag left listbox item to right listbox which adds the item; and the right listbox items can Drag&Drop up and down.
General thinking is: First- DO left listbox's Drag&Drop action; Second- Do right listbox's Drag&Drop action. But this way should make the repetitious use of judge conditions or sub_fuction.With the way of my thinking, it can decrease the repetition.
//the Drag&Drop event
private void listBoxUCP_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(System.String)))
{
object item = e.Data.GetData(typeof(System.String));
// Perform drag-and-drop, depending upon the effect.
if (e.Effect == DragDropEffects.Move)
{
updateListBoxItems(source, listBoxUCP, item, e);
}
}
}
//sub_procedure
private void updateListBoxItems(ListBox sourceListBox, ListBox targetListBox, object sourceItem, DragEventArgs e)
{
int targetIndex = getTartgetIndexFromPoint(targetListBox, e);
int sourceIndex = targetListBox.SelectedIndex;
if (sourceListBox == targetListBox)
{
if (targetIndex == targetListBox.SelectedIndex)
return;
targetListBox.Items.RemoveAt(sourceIndex);
}
//if target listboxItem != null and insert place not in the end of the itemlist,
//use the insert method
if (targetIndex > 0 && targetIndex < targetListBox.Items.Count)
{
if (sourceListBox != targetListBox || sourceIndex > targetIndex)
targetIndex = targetIndex + 1;
targetListBox.Items.Insert(targetIndex, sourceItem);
targetListBox.SelectedIndex = targetIndex;
}
// else add the item in the end of the itemlist
else
{
targetListBox.Items.Add(sourceItem);
targetListBox.SelectedIndex = targetListBox.Items.Count - 1;
}
}
private int getTartgetIndexFromPoint(ListBox listBox, DragEventArgs e)
{
Point position = new Point(e.X, e.Y);
position = listBox.PointToClient(position);
return listBox.IndexFromPoint(position);
}
Can somebody tell me the defect of my code? You think what format is the best one of this function!
Thanks for any proposals!
|
|
|
|