|
The TextChanged event isn't used to handle a key press, so you can not use it to cancel a key. When the TextChanged event is executed, the contents of the text box has already changed.
Use the KeyPress event to handle key presses.
KeyChar is not a global variable, it's a property of the KeyPressEventArgs object. Also, it's not an ASCII code, it's a char.
You would do better to look up the documentation about what you are doing, instead of just guessing.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi there,
Is suppose there is a way to select or set a different tray on a printer when printing from visual basic 6? How do i do that?
Thank for your time.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
Hi there,
Thanks for your time. I've figure it out. It's easy, use the PaperBin property of the Printer Class to specify the tray to use.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
suppose , i have to return a value from an integer type return function.
I have got two ways to return the value......, which i have mentioned in the function .
Which will be more appropriate and less memory consuming ,,, something sort of that point of view.
Private function abc()as integer
return 1
if(a="")then
abc=1
exit function
end if
end function
|
|
|
|
|
A function should have a single return statement, at the bottom. Don't worry about memory, you're talking about returning an integer.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I was talking about which case should i consider ?
latter one or former one ????????
|
|
|
|
|
The latter is typical VB nastiness, so I'd go with the former for that reason. Memory wise, I doubt it makes any difference.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I was reading the records from the database , around 250 records
I used both the datareader and the dataset.
and in both cases , i am facing the same problem , after an uncertain records or period of time.
and the problem is an error that gets occured . An Unspecified Error
Even while using dataset this problem persist(I mean dataset closes the connection with the database after reading the records in bulk.).One thing is that i know , datareader does not closes the connection until the record fetching is completed , on the other hand , dataset closes the database connection after filing the adapter.
Help.......
-- modified at 2:33 Monday 7th May, 2007
|
|
|
|
|
Nilish wrote: I mean dataset closes the connection with the database after reading the records in bulk
Actually, no. The DataSet knows nothing about the connection at all. It is the DataAdapter that opens and closes the connection.
Nilish wrote: and in both cases , i am facing the same problem , after an uncertain records or period of time.
and the problem is an error that gets occured . An Unspecified Error
Then the problem is most likely not to do with the DataReader Vs. DataAdapter, but something else. Where in the code does it fail? What are the relevant values of the variables and properties just prior to the failure.
|
|
|
|
|
the oledbconnection variable automatically get equal to nothing , when there arise an error An Unexpected Error
when i try to reassign the memory , it don't accept .until i get out of debug mode.
i am using the followinf code
dim con as new oledbconnection("connectionsting")
con.open
dim cmd as new oledbcommand("query",con)
dim dr as oledbdatareader=cmd.executereader
while(dr.read)
.................
.................
end while
Problem occurs at memory allocation to connection variable.
once the problem comes , it persist until i quit from the debug mode.
Problem does not come at first time execution of above code.the code is under button and prolem come after 10th button click
Help..................
|
|
|
|
|
You have to close the data reader and the connection when you are done with them. If you don't do that, the connection will remain in memory still connected to the database. When the connection pool is full of live connections, you can't create any more connections until one of the connections time out by itself, or until you restart the application (which is what happens when you quit from debug mode).
---
single minded; short sighted; long gone;
|
|
|
|
|
if dataset is taken .even then i am facing the problem.
-- modified at 6:37 Monday 7th May, 2007
|
|
|
|
|
I need your help to create a simple routine to add records (new users) to my tblUsers in an Access database. tblUsers has 3 fields = userName, password, accessLevel. I have tried to use an insert command, but nothing happens. I am lost. Any suggestions would be greatly appreciated! TIA
IT
|
|
|
|
|
IvanIT wrote: I have tried to use an insert command, but nothing happens.
"Nothing" rarely ever happens. What does happen? Have you verified that your code runs at all? Are you sure that the code actually executes the query? Do you get any error message?
An update query can execute without actually doing any updates, but an insert query never executes successfully without doing an insert (unless of course you make an "insert ... select ..." where the select query returns an empty result).
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi!
I have posted this several times but this time. may be its not clear what i want so below is the code
Dim ppItem As Microsoft.Office.Interop.PowerPoint.Shape
If Len(Trim(dr.Item(Strings.Right(Trim(ppItem.TextFrame.TextRange.Text), Len(Trim(ppItem.TextFrame.TextRange.Text)) - 1)))) > 0 Then
Dim s As String = dr.Item(Strings.Right(Trim(ppItem.TextFrame.TextRange.Text), Len(Trim(ppItem.TextFrame.TextRange.Text)) - 1))
s = s.Trim
ppItem.TextFrame.TextRange.Text = s
'ppItem.TextFrame.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoFalse
'========================
Dim a, b, looplen As Integer
looplen = s.Length
Dim hashWords As String()
Dim strWord As String
For a = 0 To looplen - 1
If s.Substring(a, 1) = "#" Then
a += 1
For b = 1 To looplen - 1
If s.Substring(a, 1) = "#" Then
ppItem.TextFrame.TextRange.Text = strWord
ppItem.Select(Microsoft.Office.Core.MsoTriState.msoCTrue)
ppItem.TextFrame.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoCTrue
strWord = ""
Exit For
End If
strWord += s.Substring(a, 1)
a += 1
Next
Else
ppItem.TextFrame.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoFalse
End If
Next
In above code i want all the strings send to powerpoint and make strWord bold.
could someone please help me or just give me a clue I am having really hard time to fix it
thanks
|
|
|
|
|
Why is it that when i use the updatecommand als below, i get the error: Syntaxiserror (operator missing) in query-expression
daAgent.UpdateCommand.CommandText = ("Update Agent" & _
" SET Nummer_Naam = " & agentNummerNaam & _
", Agentnummer = " & txtAgentNummer.Text & _
", Agentnaam = " & txtAgentNaam.Text & _
" WHERE(Agentnummer = " & agentNummerOud & ")")
daAgent.UpdateCommand.Connection.Open()
daAgent.UpdateCommand.ExecuteReader()
daAgent.UpdateCommand.Connection.Close()
|
|
|
|
|
Your code is susceptable to SQL Injection Attack. Please read SQL Injection Attacks and Tips on How to Prevent Them[^].
You use ExecuteReader . But you don't get any information back. You should ExecuteNonQuery() when you don't expect a result set.
You are allowing unvalidated and unsanitised user input directly into the SQL Statement. It is highly possible that this dirty information is causing problems for your SQL Statement. The advice given in SQL Injection Attacks and Tips on How to Prevent Them[^] will help you generate a safe SQL command that will be protected against that sort of error when caused by user input.
|
|
|
|
|
I need ur help guys, i m new to vb and i m trying to develop a project Account Managment. I have to generate reports using access reports. Can u help me by telling how can i do it.
|
|
|
|
|
1) which type of report u want
2) Post your Question in Proper size
SP
--
Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
|
|
|
|
|
my client's requirement is to record phone calls and making calls from my window application , please tell me about if there are any classes or any library in .NET, call must be done from our regular basic landline phone not from voip or internet . is there any code available on internet and your help desk regarding my reqirment thanks,
|
|
|
|
|
You're going to need specialized hardware to connect the machine to the phone to get the audio. Keep in mind that this won't work for all phones and phone systems due to the conversion to digital audio.
Also, please be aware that the recording of phone calls is illegal in the United States unless both parties on the line agree to it or there is a court-ordered wire tape covering the recording.
After that, you can get some information on various techniques for recording audio from this list of documents[^].
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hello!
How to detect if user drags and drops icons "My documents", "My music, "My pictures", "My videos" Or "Internet Explorer" from desktop to a listbox of my application? For example "My Document" icon on desktop isn't actually a folder and neither an ordinary shortcut. Please help!
|
|
|
|
|
I have this code in C gpio.h file:
typedef enum _DIRECTION<br />
{<br />
DIGITAL_IN = 0,<br />
DIGITAL_OUT <br />
} DIRECTION;<br />
#endif<br />
typedef int (__cdecl *GPIO_QUERY)(int pin, DIRECTION dir);<br />
typedef void (__cdecl *GPIO_CONTROL)(int pin);<br />
static GPIO_CONTROL AssertGPIO = NULL;<br />
static GPIO_CONTROL DeassertGPIO = NULL;<br />
static GPIO_QUERY QueryGPIO = NULL;<br />
//*This code in the gpioapp.c file://
#include "gpio.h"<br />
hModule = LoadLibrary("gpiodll.dll");<br />
AssertGPIO = (GPIO_CONTROL)GetProcAddress(hModule, "AssertGPIO");<br />
DeassertGPIO = (GPIO_CONTROL)GetProcAddress(hModule, "DeassertGPIO");<br />
QueryGPIO = (GPIO_QUERY)GetProcAddress(hModule, "QueryGPIO");<br />
if (QueryGPIO == 0 || AssertGPIO == 0 || DeassertGPIO == 0)<br />
{<br />
fprintf(stderr, "Fail to get DLL service");<br />
FreeLibrary(hModule);<br />
return 0;<br />
}<br />
//===========================================================================
Kindly can you help me translate this to VB6, I want to be able to use the functions AssertGPIO and DeassertGPIO.
Thanks...
|
|
|
|
|
C and VB6 have almost nothing in common. I very much doubt that VB6 has any sort of function pointer support. Your best bet is to do what people have always done to make VB6 useful, write a C++/COM app to do the work, and let VB6 call it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks for your reply, but i am not familier with C++/COM, I just need the VB decleration of the two functions AssertGPIO and DeassertGPIO to be able to call these two function of the DLL file.
|
|
|
|