hkdani 39 Posting Pro in Training

My question is how can I save the database path? because whenever I change computer from Home to School I need to reconnected all the database connections.. or else a "/db/.mdb is not a valid path" error pops out.. I still can't figure it out how to set a database path...

Show the line that is causing the error and it would be easier to help.

BitBlt has a good suggestion: trapping the error. Your home path for the database file and the school path shouldn't change and you should know the path names.

Private Sub ConnectToDB()
     On Error GoTo DBCONNECT_ERR
     Dim strDbPath as String
     strDbPath = strHomePath
     Set rst = New ADODB.Recordset
     Set cn = New ADODB.Connection
     With cn
          .Provider = "Microsoft.Jet.OLEDB.4.01"
          .Open strDbPath & "\db\My.mdb", ...., ,,
     End with
     ....
     ....
     Exit Sub
DBCONNECT_ERR:
     if strDbPath = strHomePath then
          strDbPath = strSchoolPath
     Else
          strDbPath = strHomePath
     End if     
     cn.open strDbPath & "\db\My.mdb"
     Resume Next
End Sub

This error trap just assumes that the error will be a bad path. Uuually, you want to trap the error, look at the err.Number, and then decide on what course of action to take based on the error code. But this should give you an idea. This example assumes you're at home and that you've already hard coded values for the home path and the school path in a variable that's available for the ConnectToDb sub routine.

hkdani 39 Posting Pro in Training

Oh, before I hit the sack. Do all your operations on the int*, not on the pointer to the pointer. Since you've assigned the same address of the pointer to the pointer to the int*, your values will fill in anyway.

Just remember malloc was designed to assign memory based on a variable type. So, whether you use the space for two dimensional arrays, 3 dimensional arrays, etc. All malloc cares about is that your designate the type, and it cares about how many instances of that type need to be allocated.

hkdani 39 Posting Pro in Training

I see you have a .ListSubItems But where are you declaring a ListItem. I don't see that in your code.

Dim si as ListItem
hkdani 39 Posting Pro in Training

Okay. Make life easy on yourself.

Don't typecast with a pointer to a pointer: (int**). Just use it with a pointer to a variable.

If you just have to leave the pointer to a pointer parameter in there for some reason, just declare an integer * after the function in the code, allocate memory for the integer pointer you declared, but make sure before doing that you assign it the same address as the passed in pointer to pointer parameter. Do you get my point?

You should be able to get away with that and it should still work even though you are using a pointer to a pointer. The main goal is to allocate space in memory on the heap. Your program can use that memory space for pointer to pointer to ....... etc. Just so long as you have enough memory allocated. You may not see the variables showing up in debug; but you can punch in queries for int[0][1] while debugging and see that it's working.

// void function ... blah, blah, blah
int *nArray ;

nArray = &newmatrix ;

nArray = (int*)malloc( blah, blah, blah) ;

Your pointer to pointer matrix will have the same address as the pointer you just declared. Just make sure you allocate enough memory. I don't think the compiler cares really about if you're using a pointer to pointer. It just cares about what type of variable and that you allocate enough space to handle what you …

hkdani 39 Posting Pro in Training

malloc returns a pointer to void. You're trying to typecast a pointer to an integer pointer to what malloc expects to be a pointer to a variable of whatever type. That might be the problem. Other than that, I wouldn't know what to tell you without further details.

The code runs perfectly until allocating memory for the double pointer new_matrix.

That's not too informative. Please, give us the error message, if you would.

Actually, if you're running a Windows App, you might be better off using one of the other Memory Allocation Routines: preferably HeapCreate, HeapAlloc, HeapFree.
Even CoTaskMemAlloc would work.

The purpose of memory allocation routines is to reserve memory on the heap, stack (calloc), or virtual memory for variable space. Make sure that is what you are doing. If you use the Heap functions. Then it allows your program the option of growing the heap automatically up to a limit that you can specify. So, if you don't happen to understand the dynamics of what's going on and the program needs to allocate more memory than what you expect for the variable space of the arrays, variable, etc., then HeapAlloc will be more forgiving than malloc.

hkdani 39 Posting Pro in Training

Yeah, it looks like your corresponding main function for C begins at line 22 of your posted code and ends on line 26 appropriately with the word 'end.'

And it looks like you have two functions tipareste and permuta which are at the beginning of the program. And I'm guessing that you have a couple of constants n and num. You can declare those before the main statement in C using define statements. But for as simple as this program is, you could probably just include them after the main statement as I did.

But the main part of the program calls the permuta function which in turn calls the tipareste function.

hkdani 39 Posting Pro in Training
#include <stdio.h>
// prototypes for functions.
int tipareste (int a[]) ;
int permuta (int k) ;

int main(void)
{
    int i = 10, num = 4 ;
    for (i = 1; i <= n; i++)
    {
    }
return 0 ;
}

// Put your functions down here:
// Also, goto www.cplusplus.com and go through their tutorial for learning C. And then if you have any further questions after having done this, feel free to ask.

But basically, it looks like you have 2 functions which are being called in the main part of your program (procedures). You prototype the functions and add them at the end. Or just put them completely at the beginning and bypass the prototypes.

If you have any good links for Turbo Pascal, that would be cool.

hkdani 39 Posting Pro in Training

Why do you want to regress to VB6?

There is no console program in VB6: System.Console.WriteLine You're using namespaces. Using namespaces are a superior feature of the VB.Net language.

You can use class modules in VB6 for classes. But the .NET platform was developed mainly because of the internet revolution, besides upgrading and fixing a multitude of problems with VB6. You would be better off staying with VB.Net. Most of the internet routines are far superior to what you'll find in VB6. Retrogressing code from VB.Net to VB6 is mostly an exercise in futility.

Besides, I like to keep my hair. Pulling out my hair while trying to make internet routines work in VB6 is not conducive to the health of my scalp.

hkdani 39 Posting Pro in Training

will u please make it more clear "virtual memory" "heap"..? please.?

Virtual memory. Memory from the hard drive simulated to run as Random Access Memory (RAM) when your computer runs out of RAM resources. Your system will thrash when using the swap memory or virtual memory. Performance will slow down.

The heap is just a generic term referring to the available Random Access Memory. You might want to a Google search using the two words HEAP and STACK.

hkdani 39 Posting Pro in Training

That's a good suggestion. Using one of the managed code languages is easier. However, the managed code languages were more than likely developed with C.

Eh C is more based for Console App.

The majority of the Windows API is written in C.

But most Operating System's have a media player that you can call that will handle the video and the sound at the same time. Once the media player recognizes the extension, it will play the file.

hkdani 39 Posting Pro in Training
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>

int main( void )
{
   char* buffer;
   buffer = (char*)malloc(sizeof(char)*MAX_PATH) ;
   // Get the current working directory: 
   if( (buffer = _getcwd( NULL, 0 )) == NULL )
      // code to deal with error
   else
   {
      printf( "%s\n",buffer );
      free(buffer);
   }
}

Adapt it to your needs. But use the getcwd function.

hkdani 39 Posting Pro in Training

You can still use the LoadResString function. It does not have to be used just when the user changes his locale.

But you'll just have to add more items in the resource table.

Use

LoadResString(128) for Swedish.
LoadResString(256) for English

And you'll have to some method for the user to toggle his preference. And then you need to write code to change the captions or pictures or whatever it is that you want to change.

You can write a private function in your form to accomplish the same:

Private Sub LoadResourceStrings(ByVal CountryID as Long) 

' Enter code here to change captions based on CountryID

End Sub
hkdani 39 Posting Pro in Training

You should use the International Friendly functions supplied with VB6. This must be a classroom assignment. You're not the first to post here about how to do this.

Look up the following phrase in yous MSDN documentation: "Writing International Code in Visual Basic"

But never use a string value for a date. Use the date format: #8/2/97# And you should get used to using the resource editor which is designed and supplied by Microsoft to deal with International issues:

Use the LoadResString(ByVal TagID as Long) as String function to load different values based on the locale your user has set in the Control Panel for his country. Your program will then detect the user's system's locale and use the appropriate Resource String based on the country settings of the operating system.

You'll need to load the Resource Editor Addin in your IDE. And then you need to one string table for each country you wish to support. And then when your program loads, use the LoadResString function to load the correct string value: e.g. Label1.Caption = LoadResString(cLng(Label1.Tag)) .

hkdani 39 Posting Pro in Training

You'll have to set up your program to use Active X Data Objects (ADO) : usually Microsoft Active X Data 2.X. You can use Data Access Objects (DAO). But ADO is more up to date. Not as fast. But more up to date. Do this in the References section of your IDE.

Then you have to declare and instantiate your Data Objects,

Dim rst as Recordset
Dim cn as Connection

'
Private Sub Form_Load()
     Dim strSequel as String
     ' Instantiate your objects
     strSequel = "Select TableName.Donor, TableName.Course FROM TableName WHERE TableName.Donor = 'George';"
     Set rst = new Recordset
     Set cn = New Connection

     With cn
          .Provider = "Name of your Data Provider"
          .Open   ' Fill in appropriate Values
     End With
     rst.Open "c:\Database Name.mdb", strSequel, "etc"       ' Fill in appropriate values.

End Sub
hkdani 39 Posting Pro in Training

You could add an Edit Menu to your program with a Preferences Menu Item. You could use that to toggle the buttons on your form with the checked value of the menu item.

Edit>Preferences>English.


In the code you would then change the properties to make them enabled or disabled based on the checked state of the menu item. You can change the visible property of a button to make it appear or disappear.


For a quicker, easier, and a more visible solution to the end user, you could add a toolbar with an imagelist and use images of the national flags to toggle the addition or removal of the other buttons. One button with an American or British Flag and the other button with an image of the French Flag.

If you want to add different language characters to a button and they will not show up, you can set the style property of the button to Graphical. And then use a Picture with the desired letter for the Picture property of the button.

hkdani 39 Posting Pro in Training

Use a select case statement and an array of command buttons called something say cmdBtnProp.

So you should have cmdBtnProp(0), cmdBtnProp(1), etc....

Then whenever the user clicks on one of the buttons, it will point to the same section of code. At this time, you'll use the Select Case mechanism to determine which button was pressed

Select Case Index

Case 0

Case 1

Case 2

Case 3

Case Else

End Select

Write the appropriate code inside of each case statement. That's one way. That should get you started.

hkdani 39 Posting Pro in Training

International settings can be changed in VB6 by the end user by changing the locale settings in the control panel.

In VB6 you should be careful to use international friendly code so that this can be done, for example: format(curAmount, "currency") The code will search the user's locale settings set by him in control panel for the local currency and use those settings for setting the currency symbol and the decimal point. Some countries use a dollar sign, some a pound sign. Some use a comma for a decimal point, some use a period, etc.

Thus, if your code is international friendly, you won't have to worry about writing special code for each country. International friendly functions are already built into the programming language, you just have to use them.

The same applies for formatting for time: format(dateTime, "longtime") If you use the resource editor in VB6, you can have your program load different values for the captions based on the locale settings set by the user in Control Panel.

Then instead of using the properties for caption directly to load a caption for a control, you use the tag property of the control to store a numeric value which will be used by the LoadResString() function:

Private Sub Form_Load()
    ' LoadResString(ByValID as long) as String
    Form1.Caption = LoadResString(CLng(Form1.Tag))
End Sub

Loading Menus and some other controls is different. You'll have to stick the numeric value in the caption or another property area. But one …

hkdani 39 Posting Pro in Training

wat is the every possible difference between sizeof(node*); and sizeof(node);

Any variable using the * operator means that it contains the memory address of a variable.

What is important to know is that your memory has been set aside by malloc insuring that a process or thread is accessing dynamic memory or RAM. malloc needs to know how much memory to set aside. And since variables come in different byte sizes, you must tell it which type of variable to use with the sizeof function. Using the sizeof function on an address (node*) will not tell you what size needs to be allocated for the variable node: sizeof(node).

Your program will be using a thread or process that needs to know what's inside the variable node. It will know the address, but if it has to kludge through virtual memory to find the information it needs, then your program will not operate at peak efficiency.

So, the real question is not what is the difference. But what is the reason. What is the reason for using node instead of node*.

I don't know why you're looking for differences. An address is an address. A variable is a variable. It's kind of basic. Don't make it more difficult than what it is. Wrapping your head around the meaning of pointers in C is sometimes a process that takes a few months or even a year or so for some.

hkdani 39 Posting Pro in Training

node
1. In local area networks, a device that is connected to the network and is capable of communicating with other network devices. 2. In tree structures, a location on the tree that can have links to one or more nodes below it. Some authors make a distinction between node and element, with an element being a given data type and a node comprising one or more elements as well as any supporting data structures. (MSDN)

So, you are declaring the contents of new1 to be equal to what memory is allocated for the size of the address of a node pointer variable.

the contents of new1 is allocated for the size of the address of a pointer to node
*new1 -----------------= ---- malloc ------- sizeof -------------(node*)

Many times the purpose of allocating memory on the heap is so that all memory transactions take place on the physical random access memory (RAM) of the system instead of being possibly swapped out with virtual memory; i.e the slower memory on the hard drive. This could greatly slow down a thread or a process. So, if your process or thread is constantly accessing node new1, you don't want it using virtual memory.

hkdani 39 Posting Pro in Training

What do you mean? Update the items that I checked in my listview?

That statement could have as many variations as there are people in the world. Give us your desired outcome and we could possibly give you your desired code.

hkdani 39 Posting Pro in Training

You want to use the malloc function to allocate memory on the heap for the size that a variable, array, etc. will occupy.

One way the * operator can be explained is by saying "the contents of" in its place.

So, your first example makes sense: the contents of new1 = malloc(sizeof(node))

In other words, malloc is allocating the size in bytes that node will hold in memory for the contents of new1.

A variable or an object takes up a certain amount of space or bytes in memory: a byte variable would take up more space than a long variable.

A pointer variable contains an address to a location. It holds the value of an address.

Think of a pointer variable as the address on the house: say 123.

malloc's intent is to allocate memory for what's inside the house at 123, not for allocating memory for the address on the house.

That's what you're doing in the second example: allocating memory for the address instead of what's inside the house at 123. That's not the intended use of malloc.

hkdani 39 Posting Pro in Training

The Combo Box has a Click Event. When a value in the Combo List Box is clicked, it raises the Combo_Click() Event. Select the Combo1 Control from the Control List box on the left hand side of the IDE. And then click on the Combo_Click Event. That should set code for the Click Event in the IDE editor.

Within that Click Event Write code to Add the contents of the currently selected item into the list box. The action of clicking on the Combo Box should set the current selection to the value you want to transfer to the List Box. The ListBox has an add function which you should use to add the value of the combo box to the list box.

You should be able to figure it out from there.

hkdani 39 Posting Pro in Training

Why are you putting a vbcrlf in the file name? Unless vbcrlf character happens to be part of the file name, don't include it as part of the file name.

MessageBox will not show you the vbcrlf character: it's invisible to the human eye.

hkdani 39 Posting Pro in Training

Just use the ASCII values Chart for the characters. I don't know why you're using all those Mod functions? ASCII values for the UpperCase letters run from 64- 90, lowercase from 97 - 122.

You'll have to write code to deal with any shifts that throw you over the limits (90 or 122). But you can add 2 directly to the value of the Ascii Value to obtain the shift value.

For instance the ASCII value of 'a' is 97. Add 2 it would be 99. chr$(99) would be 'c'
There are UCase and LCase functions to convert Upper to Lower and Lower to Upper case.

hkdani 39 Posting Pro in Training

Every VB6 control has a default value. For instance, the text box control's default value is text. So, if I just code say Text1, that would be equivalent to Text1.Text.

Combo1 has a default value. Find out what it is and that will help you out. It's probably text.

Other than that, you would have to say specifically which section of code is giving you problems. But the default values property can be confusing because it is not commonly known.

hkdani 39 Posting Pro in Training

I don't know. I banged my head around with VB6's internet functions. To no avail. I really don't think they work. But you're using API's.

You might try bypassing the username and password and just open the URL directly injecting the username and password into the URL: e.g., http://username:password@whatismyipaddress.com

hkdani 39 Posting Pro in Training

You need to set the connection properties before using the setting the recordset connection properties

With conn
    .Provider = "Microsoft.Jet.OLEDB.3.51" ' or 4.01 or whatever
    .Open "c:\MyAccess.mdb", "admin", ""
End with

Set Rs = New Recordset
Adodc1.RecordSource = " select * from logfile where no_ponsel = '" & textSearch & "'"
Set LogDataGrid.DataSource = Adodc1
'Rs.Open " select * from logfile where no_ponsel = '" & textSearch & "'", conn, adOpenDynamic, adLockOptimistic

The recordset functions will not work until you properly set up the ADODB connection.

hkdani 39 Posting Pro in Training

There's a property for the datagrid called AllowDelete. Set that property to True.

Otherwise, it will not allow the user to delete data.

hkdani 39 Posting Pro in Training

Well, it works with Microsoft's latest and greatest compiler 16.00.30319.01 for 80x86
And it works with Gnu C compiler 4.5.2, with Gnu C 3.4.5
Borland's 5.5.1 C Compiler.
Microsoft's Compiler 12.00.8804
Borland's old Turbo C 2.01
Borland's C++ 5.82

I might have to dig out one of my four working Apple IIe's to find a compiler it doesn't work on.

hkdani 39 Posting Pro in Training

I have no control over feedback. But I do appreciate the feedback. I don't get too excited over feedback, one way or the other.

But I tried fflush(stdout) after the first scanf and it did not work. fflush(stdin) did. So, they must have been using scanf instead of fgets.

The behavior of the program was as described by the user. Using fflush(stdin) fixed the problem. Using fflush(stdout) left the problem as before. The user must have been using an ANSI compliant system.

However, your admonition for those not using ANSI compliant systems is duly noted and the following correction is posted according to your recommendations:

char cpInt[]= "000" ;

printf ("Enter the number of student >> ");
    fgets(cpInt, sizeof(cpInt), stdin);
    fflush(stdout) ;

n = atoi(cpInt) ;
if (!n)
{
    printf("Please enter a number.\n") ;
    return 0 ;
}

Thank you for the constructive pointers. They are always appreciated.

hkdani 39 Posting Pro in Training

Good grief. Now you have an array of an array of characters: char *message[1024]. *t[50]; Use char message[1024], t[50] ;

#include <stdio.h>
int main(void)
{
    char message[]= "hello" ;
    printf("%s\n", message) ;
    return 0 ;
}
hkdani 39 Posting Pro in Training

Use fflush after your scanf or gets lines.

printf ("Enter the number of student >> ");
    scanf ("%d", &n);
    fflush(stdin) ;

..........

fgets (name[i], sizeof(name[i]), stdin);
	fflush(stdin) ;

..........
fgets (name[i], sizeof(add[i]), stdin);
	fflush(stdin) ;

You're getting unwanted characters from a previous function's return value.
fgets is preferred over gets. gets has security issues. fgets forces the limit on the size of the input(the second parameter). The first parameter is the destination, the second the limiting size, third parameter is the source. gets has no limiting size and could potentially overwrite memory.

hkdani 39 Posting Pro in Training

use fgets or gets over scanf: it's safe and secure. scanf terminates when it finds a whitespace character. A space is a whitespace character. So, Diwakar wagle gave a good suggestion to use fgets. These two functions will include the spaces and terminate when receiving the newline character '\n' or when you hit the enter key. gets will remove the '\n' character so you don't have to. fgets will include the '\n' character.
If you want your program to advance a new line without using printf("\n") ; use fgets.

#include <stdio.h>

int main(void)
{
   char string[80];

   printf("Input a string:");
   gets(string);
   printf("The string input was: %s\n", string);
   return 0;
}
hkdani 39 Posting Pro in Training

lines 30, 32

You are providing one character not a string name[i][30] . Use only the leftmost index to access the whole array of characters for the row as Ancient Dragon pointed out: string name[i] .

You don't need to use the fflush. Just keep it simple.

My bad, use the & operator.

hkdani 39 Posting Pro in Training

More than likely your program is crashing because you are asking scanf to enter a string when you only give it one character: scanf ("%s", &name[i][30]); . You must supply scanf with an array of characters: e.g. scanf ("%s", &name[i]); What you have declared char name[30][30] ; char add[30][30] is a pair of two dimensional character arrays: one two dimensional array of characters for the name and another for the address. The effect of the declaration is to allow you 30 names each with a character limit of 30 and 30 addresses each with a character limit of 30.

In a two dimensional array the rightmost value would correspond to the columns and the leftmost value would correspond to the row. In this situation, the leftmost value would indicate the name or the address: e.g., name , add.

If you use both values you are only referencing one of the values inside the row. In your case, just the last character of the row.

But a string is an array of characters; so, you must reference the row and not just the one column value in the row as you have done: name[i][30] . So, as Ancient Dragon said, just reference the row: name[i] without using the rightmost index. The printf function will look for the first instance of a null value and stop there.

So, it might be a good idea to initialize the arrays before asking for information:

// Initialize arrays with null …
Ancient Dragon commented: right +17
D33wakar commented: using "gets" is a bad idea. -1
hkdani 39 Posting Pro in Training

They both compile and give the same results.

A function has its own unique memory address. The function's entry point is this address.

Therefore, you can use a pointer to a function to call the function which is essentially what you are doing in the second declaration. int (*pFcn)(int, int) = &Add; .

When the compiler assembles the code for a function, it assigns an entry point for that function or a specific memory address. Using the address of the function (&Add) produces the same result that the compiler will eventually come up with on its own: the address of the entry point.

hkdani 39 Posting Pro in Training

This is a tough one: but this should work. You'll have to change it around, if you want to use the clrscr function. You need to break out of the nested do loop and you have to be able to exit out of the main do loop for what you desire to function properly.

#include <stdio.h>

int main(void)
{
	int temp ;
	int j ;
	float cel ;

	temp = 0 ;
	do
	{
	    printf("Enter the temperature:") ;		
	    scanf("%d", &temp) ;
	    cel = (5.0/9.0)* (temp-32);
	    printf ("%d degree F is %f degree celsius\n", temp, cel);
	    printf ("Do you have other temperature?");
	    do
	    {
		while((j = getchar()) != '\n') 
		{
		    break ;
		}
		if (j == 'n')
		    return 0 ;
	    } while (j != 'y') ;
	} while (j == 'y') ;
	 
	return 0;
}
hkdani 39 Posting Pro in Training

Well, don't post expecting immediate positive feedback. Just post out of a sincere desire to help the individual.

Cast your bread upon the waters, for after many days you will find it again.

Let us not become weary in doing good, for at the proper time we will reap a harvest if we do not give up...

By the way, you do have a pretty good ratio of feedback in relationship to the number of posts.

hkdani 39 Posting Pro in Training

Well, the request--to say the least--was confusing. I want to open the file, but not in VB?

So, you have someone asking for help in VB, but does not want to use VB? And then you give them code for doing what they request in VB.

Sigh...............

To open the file with a double click event, you must have some object that has a double click event and that is able to store file names. In the double click event, use the Shell command as so deftly posted by mb01a.

hkdani 39 Posting Pro in Training

I tried it your way. Made a directory. and used your method to delete it.
It was as I suspected: the object was not created: error 91, Object variable or block object variable not set.

A directory is not an object. An object has properties, methods, and or events.

Objects are encapsulated — that is, they contain both their code and their data, making them more easier to maintain than traditional ways of writing code.

Visual Basic objects have properties, methods, and events. Properties are data that describe an object. Methods are things you can tell the object to do. Events are things the object does; you can write code to be executed when events occur.(MSDN: Programming with objects)

Set objdir = New Scripting.FileSystemObject

hkdani 39 Posting Pro in Training

It does not look like you have instantiated your object. Use one of the following 2 methods:

Dim fso as FileSystemObject
set fso = new FileSystemObject

' Or
Dim fso as New FileSystemObject

The first method is early binding and is quicker. The second method is late binding and is somewhat slower.

Or maybe I'm just not used to your methodology of instantiating an object. I don't usually do it that way. Doesn't mean that your way is not correct.

hkdani 39 Posting Pro in Training

This is not really a VB question. You're in the wrong forum. Unless you want to use vb to change the registry, etc.

But in Windows Explorer choose the Tools menu>FolderOptions>File Types. Associate the extension with a program. And that's it.

hkdani 39 Posting Pro in Training

This usually means that the function you're requesting from your ActiveX Database Object (ADO) is not supported.

Which probably means you're not using the right cursor type for the function that you are requesting. Certain functions are only supported with certain cursor types.

You might try changing which type of cursor type you're requesting. I've most often seen this message come up when not using the right cursor type.

You have four choices: Dynamic, Forward Only, Keyset, Static. Try switching the cursor type. Or you might have an improperly formed query statement. Dynamic is used for SQL type Query statements, Keyset is used with a plain table search. Etc.

hkdani 39 Posting Pro in Training

Well, you have to have some text in the Combo Text to begin with. I don't know if you explained how your were going to do that. You can type it in directly.

But there are several events you could use to trigger a search into your database: Check the Events listed in the right column in your code window of the Integrated Development Environment (IDE) for the Combo Control. You could use the click event, Double Click Event, Key up, etc. Write code to do your search and fill your labels inside that event.

Or you could add a command button to click on using the value in the combo box to use a search.

hkdani 39 Posting Pro in Training

One way is to add the Scripting Type Library to your project and use the File System Object. From the Project Menu in your IDE, choose the References Menu. Look for the Microsoft scripting runtime libray and add it to your project.

Private Sub DeleteFolder (ByVal FolderName as String)
Dim fso as New FileSystemObject

fso.DeleteFolder (FolderName)
' Zero out memory for file system object
set fso = Nothing
End Sub
hkdani 39 Posting Pro in Training

You can dynamically load a label, but you must have at least one on the form to begin with.

What you probably want to do is load the values into your combo box and assign the label value at the same time within your given Do loop. You will also have to add code--if you want to dynamically add labels--to position the labels so that you can see them. If you want to make it simpler, create and place an array of 8 labels on the form to begin with.

If you are going to use the same labels for each search, then you'll have to initialize the labels to a vbNullString value before entering your Do Loop so that you won't have any left over data from a previous query.

Dim i as Integer 
i = 0

' Clear Label values
for i = 0 to 7
   label1(i).Caption = vbNullString
next i

Do Until Data1.Recordset.EOF 'Stops when there are no more records to be added
CmbProduct.AddItem Data1.Recordset("Product Name") 'Loads all the Products from the database and adds them to the combo box
label1(i).Caption = CmbProduct.Text
Data1.Recordset.MoveNext 'Moves onto the next record after the previous has been added
i = i + 1
Loop
hkdani 39 Posting Pro in Training

Yeah, you're right. You need to use some API calls to select the region you want to save and save that into a bitmap file.

It's a complicated process for a C Programmer. But it looks like that is what you'll have to do to accomplish your purpose: Check out this link for an example: http://msdn.microsoft.com/en-us/library/dd145186%28v=VS.85%29.aspx

You can check out the following site for some useful examples: http://allapi.mentalis.org/

hkdani 39 Posting Pro in Training

Just use the SavePicture method SavePicture Picture, FileName For the picture parameter, you probably have to use the object with the picture property. SavePicture Picture1.Picture, "MyPicture.bmp"

hkdani 39 Posting Pro in Training

Ok, this is the .NET version. In the future post .NET questions on the .NET forum.

To move a directory and rename it use the MoveDirectory method: specify the source and target directories.

In general, just post what you wish to accomplish and ask for instructions on the appropriate topic in the appropriate forum.

My.Computer.FileSystem.MoveDirectory("C:\MyDir1", _
    "C:\MyDir2", True)
hkdani 39 Posting Pro in Training

This code has problems. It should be simplified: creating objects in arcane and roundabout ways, too many lines of code to do a simple operation, etc.

MoveFile is also a Win32 API kernel32 function. It returns a boolean value . Looks like whoever wrote this VB MoveFile function is trying to parrot the MoveFile API.

If you want to use the MoveFile API, then declare it properly first. Private Declare Function MoveFile lib "kernel32" Alias "MoveFileA" (ByVal lpExistingFileName as String, ByVal lpNewFileName as String) as long All it does is rename the file or folder name. It returns 0, if it fails. Otherwise, it returns a nonzero value if successful.

It's pretty sad when you can write 6 or 7 lines of code to do the same thing using Win32 APIs to replace about 40 lines of VB6 code. This is a prime example of violating the programmer's paradigm of KISS: Keep It Simple Stupid. Visual Basic was designed to make things simple, not complicated.

And you're requesting .NET information on a VB6 forum. You are in the wrong place.
Whereever you got this code, it is more complicated than it should be. If you wrote this code, you obviously don't need any help. Or you're just bored and looking for a good laugh.