|
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
zeeshi_24 wrote: send me the complete code in vb.net or c#
It does not work like that around here. You need to try and do your own work, and when you are stumped, ask for help.
zeeshi_24 wrote: .i need help in encryption and compression of video file (mpeg)..
Google it.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
<br />
Public Sub log_error(ByRef msg As String)<br />
If g_Trace = 1 Then<br />
On Error Resume Next<br />
FileOpen(255, VB6.GetPath & "\err.log", OpenMode.Append)<br />
PrintLine(255, msg & " " & Today & " " & TimeOfDay)<br />
FileClose(255)<br />
<br />
End Sub<br />
Please tell me how i will convert this code into vb.net.....
I will be very much Thankful.
|
|
|
|
|
soniasan wrote: how i will convert this code into vb.net.....
Meet my friend, google.com[^]....
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Public Sub LogError(ByVal message As String)<br />
<br />
Dim filename As String = System.IO.Path.Combine(Environment.CurrentDirectory, "err.log")<br />
Using writer As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(filename, True)<br />
writer.WriteLine(message & Date.Now.ToString(" dd.MM.yy HH:mm:ss"))<br />
End Using<br />
<br />
End Sub
Hope this helps
Tom
|
|
|
|
|
How can I read a text or csv file by ado.net.The following code is working fine with vb 6.0 but when I try to use the same code with vb.net 2005 it gives me an error at <b>Rcdfile.open </b>line.
The following error I am getting.
[Microsoft][ODBC Text Driver]'6.0' is not a valid name.Make sure that it does not include invalid character or punctuation and that it is not too long.
Here is the code which I am using to open the file.
Dim Conn As New ADODB.Connection
Dim RcdFile As New ADODB.Recordset
Conn.Open("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & mPath & " ; ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False")
RcdFile.Open("Select * From " & Me.OpenFileDialog.FileName & "", Conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
Any idea where I am wrong.
THanks in advance
<div class="ForumMod">modified on Thursday, January 24, 2008 9:39:36 AM</div>
|
|
|
|
|
I got the problem.Actually I was giving the filename with the path in the file open line where it should be only filename without path.
|
|
|
|
|
hi all
i have the Following function, that inspect a string and return an integer for a certain partten. Every time i run this Function it returns "0", for example if i pass "PV000000" it will return "0" if i pass "GEOSS001" it will return "0", what is wrong
<br />
Private Function FindCategory(ByVal strFunc_key As String) As Integer<br />
Dim intval As Integer<br />
<br />
If strFunc_key.Substring(0, 4) = "GEOSS" Then<br />
intval = 12<br />
ElseIf strFunc_key.Substring(0, 4) = "PV000" Then<br />
intval = 1<br />
ElseIf strFunc_key.Substring(0, 4) = "PVDIF" Then<br />
intval = 2<br />
ElseIf strFunc_key.Substring(0, 4) = "PVNTR" Then<br />
intval = 3<br />
End If<br />
Return intval<br />
<br />
End Function<br />
<br />
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
hi,
consider this line
If strFunc_key.Substring(0, 4) = "GEOSS" Then
the substring function takes two argumets in above line. first is start index & second is length of string which you specify 4. so how can you compare this substring(4 character) to other string(Geoss,pv000 etc)
use following statement
If strFunc_key.Substring(0, 5) = "GEOSS" Then<br />
intval = 12<br />
endif
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hi Rupesh Kumar Swami
Thank you very much, i understand, the mistake i made, is that i started counting the string am comparing from "0" instead of "1"
Thanks its working
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Firstly you need to test for 5 characters not 4 e.g. "GEOSS" contains 5 characters
Secondly what happens if not of the conditions are true?
Personally, I would use a SELECT CASE rather than nested IFs
example :-
Private Function FindCategory(ByVal strFunc_key As String) As Integer<br />
Dim intval As Integer<br />
<br />
Select Case strFunc_key.Substring(0, 4) <br />
CASE "GEOSS"<br />
intval = 12<br />
Case = "PV000" <br />
intval = 1<br />
Case "PVDIF" <br />
intval = 2<br />
Case "PVNTR" <br />
intval = 3<br />
Case Else<br />
intval = 0<br />
End Select<br />
Return intval<br />
<br />
End Function
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thank very much
its working, my mistake
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
I have created a windows user control but whenever i add to a form in a new project it tells me that the control is not part of the form
Plz help.
The control is a GUI Control that i drop on a form..
ther error is like this
"UserCOntrol1 not part of me.Form1"
Thanks
phatkin
|
|
|
|
|
I also hope we can have a single user control project with multiple controls inside?
Thanks
phatkin
|
|
|
|
|
I have two ListBox in vb.net. I want if a user drag any item from one listbox and drop it into other then it got add in other listbox.]
please help
|
|
|
|
|
Hello,
You can try out this code. I have used two Listboxes on a form.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim i As Integer<br />
<br />
For i = 0 To 19<br />
<br />
Me.ListBox1.Items.Add("Item " & (i + 1).ToString)<br />
<br />
Next<br />
<br />
End Sub<br />
<br />
<br />
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown<br />
<br />
Try<br />
<br />
ListBox1.DoDragDrop(ListBox1.SelectedItem, DragDropEffects.Copy)<br />
<br />
Catch ex As Exception<br />
<br />
MsgBox("Drag Error: " & ex.Message)<br />
<br />
End Try<br />
<br />
End Sub<br />
<br />
<br />
<br />
Private Sub ListBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragDrop<br />
<br />
ListBox2.Items.Add(e.Data.GetData(DataFormats.Text))<br />
<br />
End Sub<br />
<br />
<br />
<br />
Private Sub ListBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragEnter<br />
<br />
If e.Data.GetDataPresent(DataFormats.Text) Then<br />
<br />
e.Effect = DragDropEffects.Copy<br />
<br />
Else<br />
<br />
MessageBox.Show("No Text Present")<br />
e.Effect = DragDropEffects.None<br />
<br />
End If<br />
End Sub
I believe this should assist you.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
|
In vb.net I want when i run the form then initially by default the focus is on the textbox1.I set its tabindexproperty to zero but it wont works.
I also set TextBox1.Focus=true on form load event it also not works.
please help me.
|
|
|
|
|
Have you tried the SetFocus() method?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks for the suggestion but there is no setfocus method in vb.net. it is in vb6.
|
|
|
|
|
sumit7034 wrote: it is in vb6
What? Your code?
VB.NET has a Focus() method. I teach it to my college students every semester
I meant Focus and not SetFocus
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
actually sir focus() method is working on button click event but i m trying it on form load event where it is not working.
|
|
|
|
|
hi sumit7034
thats Simple and vote for this thread after this
first this you want to set a focus on a textbox onload ? well do the following. in your formload put in the following code
<br />
'Set the Focus to your textbox when the form load<br />
Tetxtbo1.Focus()<br />
'Disable the button, because the focus will go to it first<br />
Button1.Enabled = False<br />
on your textbox in the KeyPress event put in the following code
<br />
'Enabling the Button when a user start entering something on the<br />
'textbox<br />
search.Enabled = True<br />
Hope this Helps
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Or, much simpler, just set the textbox's TabIndex to 1 in the designer window.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi all,
Background: I have some tools provided by a vendor that I need to write a wrapper script around. The wrapper script has to check a few things, then call those command line tools. I am seeing a problem when the commands output a large amount of text, the script seems to get "stuck".
I think it's a result of the buffer filling up and then the command gets suspended. I am polling stdout and copying anything on it to my own stdout, but it seems that large amounts of output still cause it to freeze up.
Here is the relevant code:
<br />
Dim MyCommand<br />
MyCommand = "%comspec% /c " & CommandLine & " 2>&1"<br />
<br />
' Run the command<br />
Dim objShell, objExec<br />
Set objShell = CreateObject("WScript.Shell")<br />
Set objExec = objShell.Exec(MyCommand)<br />
<br />
' Output stdout from command<br />
Do Until objExec.StdOut.AtEndOfStream<br />
If Not objExec.StdOut.AtEndOfStream Then<br />
WScript.StdOut.WriteLine objExec.StdOut.ReadLine<br />
End If<br />
Loop<br />
<br />
' Wait for the command to finish<br />
Do While objExec.Status = 0<br />
WScript.Sleep 100<br />
Loop
The ideal situation is if I could call the subcommands and allow their stdout/stderr to flow to the correct place in my script's output buffers, but so far I have not found a way to do this. The next best thing would be if this polling would actually work all the time, and keep the correct order of the output. The worst solution would be to save the output to a file, then output it myself later.
|
|
|
|