|
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.
|
|
|
|
|
Alex_73 wrote: but i am not familier with C++/COM,
I guess you're stuck then
Alex_73 wrote: I just need the VB decleration
But, you see, C is a powerful language, Vb6 is a beginner language. There is no guarentee that such a declaration exists, and there IS a guarentee that C can do things that VB6 plain can't. I believe this is one of them.
VB6 is also completely out of date and unsupported. Why are you stuck with having to use a dead language ?
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 anyways, I had to do it in VB as its part of awhole project done before in VB, maybe we need to change the project at the earliest to something like C++ or Java...
I solved this problem by writing a new simple c++ DLL includes the .h file and the some of the .cpp code, this new DLL exports the functions to be used in VB6.
|
|
|
|
|
Hey guys,
Got a little problem...I created the program ConvertXBatch. (A batch utility for ConvertXtoDVD as it doesnt have its own batch functions.) Anyway, when you are converting a movie, it will display something like this in the title bar of ConvertXtoDVD.
"ConvertXtoDVD - 1.5%
Now I have written this stuff below, which is supposed to loop through all the processes till it finds the ConvertXtoDVD one..so..
1. Loop through processes searching for ConvertXtoDVD in the title..
2. When found store the ProcessID, set found to True.
3. Then parse the title so all I have left is the digit before the decimal point.
4. Update the progress bar.
Now, this is currently set at every 5 seconds because it uses alot of CPU every time it cycles through that loop. Now the only problem is when Found gets set to true, when a new instance starts of ConvertXtoDVD, it might (most likely) get a different processID, which then returns an ArgumentOutofRange Exception.
I did have the Found variable in the declaration part so that it only looped once on the first round...but that caused problems too..
Does anyone have any suggestions?
Public Sub getPercent()
Dim found As Boolean
Dim id As Integer
Dim temp As String = ""
Dim percent As String = ""
Dim proc2 As Process
Dim progPercent As String = ""
While Not found
For Each proc2 In Process.GetProcesses
If proc2.MainWindowTitle.Contains("ConvertXtoDVD") Then
found = True
id = proc2.Id
End If
Next
End While
If found Then
proc2 = Process.GetProcessById(id)
temp = ""
temp = proc2.MainWindowTitle.Remove(0, 16)
percent = temp.Remove(temp.Length - 1, 1)
progPercent = percent.Remove(percent.Length - 2, 2)
fileProgress.Value = progPercent
Label1.Text = progPercent
End If
End Sub
Basically, I would like it too loop once to find the processID, then next time it gets the percent it doesnt have to loop, it can use the processID.
This is on Windows Vista (UAC turned Off), Visual Studio 2005.
|
|
|
|
|
You can probably speed this up a bit by using GetProcessesbyName instead. This way, you won't have to iterate through every process running on the system, checking it's title bar text, you'll have to just the processes with your ConvertXBatch stuff.
Once you have found them, you'll probably want to create a class to watch that specific process, and only that process. You can write it so it handles the Exited event of the Process object.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
im building a login form using mysql but i cat figure out how to check if the username and password is correct.
this is the code i have
Try
conn.Open()
da = New MySqlDataAdapter("SELECT * FROM tblSysLogin WHERE username='" & TextBox1.Text.ToString & "' and password='" & TextBox2.Text & "'", conn)
myCommand.ExecuteScalar()
If myCommand.ExecuteScalar > 0 Then
MsgBox("success")
Else
MsgBox("error")
conn.Close()
End If
Catch myerror As MySqlException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
End Try
but dont work....
it say "Connection must be valid and open"
any ideas?
thanks
|
|
|
|
|
What is your connection string? I didn't see anything about that in your sample code...
|
|
|
|
|
Imports MySql.Data.MySqlClient ' this is to import MySQL.NET
Public Class Form1
Dim connString As String = "server=seerver;" _
& "user id=username;" _
& "password=xxxxxxx;" _
& "database=databasename"
Dim conn As New MySqlConnection(connString)
Dim da As MySqlDataAdapter
Dim dst As New DataSet
Dim State As StateEnum
Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
conn.Close()
conn.Dispose()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Dim myCommand As New MySqlCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
conn.Open()
da = New MySqlDataAdapter("SELECT * FROM tblSysLogin WHERE username='" & TextBox1.Text.ToString & "' and password='" & TextBox2.Text & "'", conn)
myCommand.ExecuteScalar()
If myCommand.ExecuteScalar > 0 Then
MsgBox("success")
Else
MsgBox("error")
conn.Close()
End If
Catch myerror As MySqlException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
End Try
End Sub
End Class
this is the complete code i have in the login form
|
|
|
|
|
LegionFX wrote: Dim connString As String = "server=seerver;" _
& "user id=username;" _
& "password=xxxxxxx;" _
& "database=databasename"
Make sure the MySQL service is running on the machine named seerver, or you could try the ip address of seerver. I think you may need to specify the port as well, which is default to 3306...
|
|
|
|
|
The server is running fine. the connection is fine, the only problem i have in the code is finding out how to check if the username and password exist in the database table .
ive searched on google but only find integrated security and msaccess examples (in vb.net).
Cheers...
|
|
|
|
|
LegionFX wrote: da = New MySqlDataAdapter("SELECT * FROM tblSysLogin WHERE username='" & TextBox1.Text.ToString & "' and password='" & TextBox2.Text & "'", conn)
myCommand.ExecuteScalar()
I don't see anything tying da to myCommand . That might be the problem. Also, the query is subjected to injection attacks, so I'd be careful with that. One great article on this site to check out is SQL Injection Attacks and Some Tips How to Prevent Them[^]...
|
|
|
|
|
there is no attachment between da and myCommand,
if you are trying to get the data,
use mysqldatareader with mysqlcommand.
dim dr as mysqldatareader
dr = cmd.executeQuery()
if dr.read() then
msgbox "success"
else
msgbox "incorrect login"
end if
or if you want to use mySQLDataAdapter then use it with mysqldataset
Vilsad P P
MCTS (Windows Applications) .Net 2.0
|
|
|
|
|
.... nope... i dont want to get the data, i just want to read it to check if certain data is present in the database, and give a true or false result (user exists or not in the database)
your code help a bit but whats the declaration for the CMD.executeQuery.
Cheers and thanks
|
|
|
|
|
case closed, finaly its done.
~
Dim sSQL As String
Dim conn As New MySqlConnection("server=xxxxxx;" _
& "user id=xxxxxxx;" _
& "password=xxxxxxxx;" _
& "database=xxxxxxxx")
Dim cmd As MySqlCommand
Dim drData As MySqlDataReader
Try
conn.Open()
sSQL = ("SELECT * FROM tblSysLogin WHERE username='" & TextBox1.Text.ToString & "' and password='" & TextBox2.Text & "'")
cmd = New MySqlCommand(sSQL, conn)
drData = cmd.ExecuteReader()
If drData.Read() Then
MsgBox("success")
Else
MsgBox("incorrect login")
End If
Catch myerror As MySqlException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
End Try
so simple and so complicated.... lol thanks for all you help guys. Cheers
|
|
|
|
|
LegionFX wrote: thanks for all you help guys
Glad you got it working
|
|
|
|