Welcome to Foxite.COM Community Weblog Sign in | Join | Help

Updated treeview control

In this sample you can track the settings in treeview control i.e. the last  node selected by user, nodes are expanded or collapsed.

If you set "Remember settings for next time" checkbox then system will automatically navigate to the last selected node that you have selected while quiting the application.
The nodes that you have expanded will be expanded automatically and collapsed nodes will be collapsed by default.

if you will set this parameter off then form will be loaded in normal.

Any comments/suggestions are highly appreciated.

 

Regard,

Surinder Singh

posted by sur200 | 4 Comments
Filed Under:
Attachment(s): tree.zip

Access vfp stored procedure in .Net

Hi all,

Here is a sample on how to access vfp stored procedure inside .Net.

This example is using OLEDB provider for accessing VFP stored procedure in .Net.

Here is a sample:

Create a test.dbc database inside your local drive say "D:"

CD d:\

CREATE DATABASE test.dbc

SET DATABASE TO TEST

CREATE TABLE login(userName c(20),age n)

Then edit stored procedure and add new procedure:

PROCEDURE vfpInsertProc

   LPARAMETERS tcName, tnAge

   INSERT INTO login values(tcName,tnAge)

ENDPROC

put the following code in any button's click on your C# form.

string str;

str = "Provider=vfpoledb.1;Data Source=d:\\test.dbc";

// the aboce line can be re-written as

//str = @"Provider=vfpoledb.1;Data Source=d:\test.dbc";

OleDbConnection conn = new OleDbConnection();

conn = new OleDbConnection(str);

// you need to inculde the following line in try - catch block

conn.Open();

MessageBox.Show(conn.State.ToString());

if (conn.State == ConnectionState.Open) // check if connection is opened

{

   OleDbCommand cmd = new OleDbCommand();

   cmd.Connection = conn;

   cmd.CommandType = CommandType.StoredProcedure;

   cmd.CommandText = "vfpInsertProc";

     cmd.Parameters.Add("tcName","Singh");

     cmd.Parameters.Add("tnAge",27);

   //cmd.CommandTimeout = 30;

   cmd.ExecuteNonQuery();

   conn.Close(); //close the connection

}

Run your form and check table login in foxpro for newly added record from C#.net

 

I think it will help you to access vfp stored procedure in .Net

 

 Thanks & Regards

Surinder Singh

posted by sur200 | 1 Comments
Filed Under:

Chat application in foxpro

This is my first chat program in VFP and i would like to share it with others so that i can get new ideas on how can i improve it?

I need to develope this application for my company because there were around 1000 of employees working and they were either communicating on phones or by using internet chatting sites like gtalk/yahoo etc.

But the problem was this that all the users were not allowed to access these websites during office hours, so they were looking for some type of application by which they can communicate with each other in their intranet.

I tried searching on internet and found one developed chatting program in foxpro written by someone.

But it could not solve my problem because in that application you can talk to any one person at a time and your messages can't be visible to other users.

and our requirement was to chat in both modes either public or private.

So finally i decided to develope it by myself.

In this application i have provided both features i.e. you can chat either in publice mode or in private mode

Public Mode: your sent messages will be visible to all the users who are connected to this application.

Private Mode: your message will be visible only to the user to whom you have sent it.

In this application i have used centralised database.

Features:

1. You can set "Remember me on this computer" to true. By doing this next time when you will login to application it will automatically restore your password.

2. If you have minimized your chat application window and any user will send you private message or any new user logged into application then you will get noticed it at right bottom corner of your screen. (i tried something similar that we get when we minimize our gtalk window and get new message)

3. If you are already logged in application and try again to login, you will get message "You are already logged in. Do you want to login again" and if you select "Yes" then new instance of application will be opened for you.

Instructions:

1. Download the attachment.

2. Build exe and place exe at some common location from where all of your users can access it.

3. Copy the data folder along with your exe file.

What to learn:

1. You will also learn how to create moving text in foxpro.

2. You will also learn how to blink text in foxpro.

Note: this is only limited version of this application. (this application also has other features like you can send mails, your inbox etc.)

It is compiled in vfp9 sp1.

Any comments/feedbacks/suggestions are highly appreciated.

Regard,

Surinder Singh

posted by sur200 | 2 Comments
Filed Under:
Attachment(s): chat.zip

Searching values in TreeView Control

This sample shows how can we work with treeview control.

1. You can add, delete,rename any node in the treeview control.

2. You can search for any node. You can search in forward or backward direction and also you can specify the search options e.g. either you want to search the exact match or you want to search the match case.

You can also search all the values at one time, for this just set "Search All" checkbox.

It will highlight all the matching values in Red forecolor.

There are also some other features like setting background color of treeview control, expand/collapse nodes.

Also i am currently working on drag & drop in treeview control. If anyone has worked on the same already then please provide me the solution on how can we drag & drop in Treeview control.

Any comments/suggestions are highly appreciated.

 

Regard,

Surinder Singh

posted by sur200 | 2 Comments
Filed Under:
Attachment(s): tree.zip

How to search values in grid

This is my first article that i would like to share with foxite members.

Most of times I have seen users either scrolling down or sorting grid columns to find any values.

I also know some programs that enable you to search in any column by just typing the text that you need to search.

But it only perform search on a single column and if same value exists in any other column then you need to go to that column and again type to search.

I have created this sample form to perform searching in grid's columns.

you can search either backbard or forward direction to search any value.

It searches from your current column.

You can also search exact match or just matching criteria.

If any of our foxite member has any new idea, they are most welcome.

Regards,

Surinder Singh

posted by sur200 | 1 Comments
Attachment(s): gridSrch.zip