|
"You can create a excel file through File.Create method. In order to import and export the data, you can create a OleDB connection to the excel file and then use SQL commands on it."
sorry friend for being late but how could i do i need an example
ezzat oraby
|
|
|
|
|
'i made class in seperate file
Imports System.Threading
Class program
Private Class MessageInfo
Private iteration As Integer
Private message As String
Public Sub New(ByVal iteration As Integer, ByVal message As String)
Me.iteration = iteration
Me.message = message
End Sub
Public ReadOnly Property Iterations() As Integer
Get
Return iteration
End Get
End Property
Public ReadOnly Property Messages() As String
Get
Return message
End Get
End Property
End Class
Public Shared Sub DisplayMessage(ByVal state As Object)
Dim config As MessageInfo = TryCast(state, MessageInfo)
If config Is Nothing Then
Dim count As Integer
For count = 0 To 2 Step count + 1
Console.WriteLine("a thread pool example")
Thread.Sleep(1000)
Next
Else
Dim count As Integer
For count = 0 To config.Iterations - 1 Step -1
Console.WriteLine(config.Messages)
Thread.Sleep(1000)
Next
End If
End Sub
End Class
'and try to use it in sub Main
Imports System.Threading
Module Module1
Sub Main()
ThreadPool.QueueUserWorkItem(MessageInfo.DisplayMessage)
Dim info As New MessageInfo(5, "a thread pool example with arguments")
ThreadPool.QueueUserWorkItem(MessageInfo.DisplayMessage, info)
Console.WriteLine("Main method complete. press enter")
Console.ReadLine()
End Sub
End Module
error
Error 1,2,3 Type 'MessageInfo' is not defined. C:\Documents and Settings\Sokar\My Documents\Visual Studio 2005\Projects\ConsoleApplication16\ConsoleApplication16\Module1.vb 7 25 ConsoleApplication16
Ahmed hassan
|
|
|
|
|
Dont post this a second time. Keep it in your original post thread. Also, this problem has nothing to do with threading.
|
|
|
|
|
i try to convert c# code to vb.net code but i have probelm with execute displayMessage in Main sub .I am trying to covert the code at many websites which provide coverting service but most of it have the same error
can any one concert it to vb.net code
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace ConsoleApplication13
{
class Program
{
private class Massegeinfo
{
private int iterations;
private string massage;
public Massegeinfo (int iterations,string massage)
{
this.iterations=iterations;
this.massage=massage;
}
public int Iterations{get{return iterations;}}
public string Massage{get{return massage;}}
}
public static void displayMessage(object state)
{
Massegeinfo config=state as Massegeinfo ;
if (config==null)
{
for(int count=0;count<3;count++)
{
Console.WriteLine("a thread pool example");
Thread.Sleep(1000);
}
}
else
{
for(int count=0;count < config.Iterations;count++)
{
Console.WriteLine(config.Massage);
Thread.Sleep(1000);
}
}
}
static void Main(string[] args)
{
ThreadPool.QueueUserWorkItem(displayMessage);
Massegeinfo info = new Massegeinfo(5, "A thread pool example with arguments");
ThreadPool.QueueUserWorkItem(displayMessage, info);
Console.WriteLine("Main method complete. press enter");
Console.ReadLine();
}
}
}
Ahmed hassan
|
|
|
|
|
What is the error?
I suspect it is to do with the for-next loop and the indexes used, but without knowing the error you are getting it is difficult to be sure.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
i tried to convert this code i made class in seperate file
Imports System.Threading
Class program
Private Class MessageInfo
Private iteration As Integer
Private message As String
Public Sub New(ByVal iteration As Integer, ByVal message As String)
Me.iteration = iteration
Me.message = message
End Sub
Public ReadOnly Property Iterations() As Integer
Get
Return iteration
End Get
End Property
Public ReadOnly Property Messages() As String
Get
Return message
End Get
End Property
End Class
Public Shared Sub DisplayMessage(ByVal state As Object)
Dim config As MessageInfo = TryCast(state, MessageInfo)
If config Is Nothing Then
Dim count As Integer
For count = 0 To 2 Step count + 1
Console.WriteLine("a thread pool example")
Thread.Sleep(1000)
Next
Else
Dim count As Integer
For count = 0 To config.Iterations - 1 Step -1
Console.WriteLine(config.Messages)
Thread.Sleep(1000)
Next
End If
End Sub
End Class
'and try to use it in sub Main
Imports System.Threading
Module Module1
Sub Main()
ThreadPool.QueueUserWorkItem(MessageInfo.DisplayMessage)
Dim info As New MessageInfo(5, "a thread pool example with arguments")
ThreadPool.QueueUserWorkItem(MessageInfo.DisplayMessage, info)
Console.WriteLine("Main method complete. press enter")
Console.ReadLine()
End Sub
End Module
error
Error 1,2,3 Type 'MessageInfo' is not defined. C:\Documents and Settings\Sokar\My Documents\Visual Studio 2005\Projects\ConsoleApplication16\ConsoleApplication16\Module1.vb 7 25 ConsoleApplication16
Ahmed hassan
|
|
|
|
|
The code won't compile until you supply the library and reference supplying the MessageInfo class. This is not a class that comes in the .NET Framework. You'll have to go back to where you got the code from and see if you can find any information on where this class is comming from.
|
|
|
|
|
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Threading
Namespace ConsoleApplication13
Friend Class Program
Private Class Massegeinfo
'INSTANT VB NOTE: The variable iterations was renamed since Visual Basic does not allow class members with the same name:
Private iterations_Renamed As Integer
'INSTANT VB NOTE: The variable massage was renamed since Visual Basic does not allow class members with the same name:
Private massage_Renamed As String
Public Sub New(ByVal iterations As Integer, ByVal massage As String)
Me.iterations_Renamed=iterations
Me.massage_Renamed=massage
End Sub
Public ReadOnly Property Iterations() As Integer
Get
Return iterations_Renamed
End Get
End Property
Public ReadOnly Property Massage() As String
Get
Return massage_Renamed
End Get
End Property
End Class
Public Shared Sub displayMessage(ByVal state As Object)
Dim config As Massegeinfo=TryCast(state, Massegeinfo)
If config Is Nothing Then
For count As Integer = 0 To 2
Console.WriteLine("a thread pool example")
Thread.Sleep(1000)
Next count
Else
For count As Integer = 0 To config.Iterations - 1
Console.WriteLine(config.Massage)
Thread.Sleep(1000)
Next count
End If
End Sub
Shared Sub Main(ByVal args() As String)
ThreadPool.QueueUserWorkItem(AddressOf displayMessage)
Dim info As New Massegeinfo(5, "A thread pool example with arguments")
ThreadPool.QueueUserWorkItem(AddressOf displayMessage, info)
Console.WriteLine("Main method complete. press enter")
Console.ReadLine()
End Sub
End Class
End Namespace
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
|
|
|
|
|
hi,
sorry for post here....
how to increase field height in dynamically crystal report???
bez sometimes text will print morethan two lines.
so when this line will come.its dynamically change height..
plz give me solution...
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Hi all,
The following code is giving "Error: The rowset is not bookmarkable." error.
please help me out.
Dim cmd As New ADODB.Command
cmd.ActiveConnection = Vcn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_help('CNSM')"
If Vrs.State = 1 Then Vrs.Close
Vrs.CursorLocation = adUseClient
Vrs.CursorType = adOpenDynamic
Set Vrs = cmd.Execute
Set DG1.DataSource = Vrs
Set DG1.DataSource = Vrs line is giving above error..
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
I'm definitely rusty on VB6 & ADO, but I think your problem is here:
Vrs.CursorType = adOpenDynamic
Try to change it to:
Vrs.CursorType = adOpenForwardonly
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hi,
I have tried all four types of Cursor Types. But no use...
Please give me some other solution.
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
Ok I found out where the problem is: see here[^].
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
|
hello every one,
I want to fix two columns of datagridview so that they can not be deleted on double click i tried for Google search but cant get any thing..
Please some one suggest me for the approach.
Thank You...
|
|
|
|
|
That makes no sense, it's your app, if the user can delete a column you must have written code to do so. In there you must identify the column index, deal with it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi, How I can read Cd or DVD sectors directly in Visual basic 6 and store specific sectors binary data in array? Thanks alot.
|
|
|
|
|
That's not standard functionality of VB6. I'd suggest you write this new functionality in .NET[^], and look for a way to "launch" it from your VB6-application
I are Troll
|
|
|
|
|
Hi all,
i have some things by which my application detect by antivirus.
List of actions are mention as follows that is detected by antivirus.
1. Key hook of keyboad.
2. Sending an email by my application.
3. Use Shell execute to run another application.
4. Command use to put an application in startUp.
...
please tell me how can i do all these work without detecting by antivirus.
Please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: please tell me how can i do all these work without detecting by antivirus.
You can't. Such programs look for behavior, and those four points seem exactly like the behavior that a virus would display.
You're running a process that sets a hook, sends mails, starts by itself? Yeah, I'd expect Avast! to catch that if something comparable is on my system.
Ditch the hook, and let the application-setup (the installation-package) put you in the start-up group. That should lower the threat a bit
I are Troll
|
|
|
|
|
From what you described, your only option is to scrap your application. You're doing everything a virus would do. Keyboard hooking, impersonating the user and sending emails, shelling a new process and self-registering the app to put itself in startup. Yep - sounds like a virus to me.
|
|
|
|
|
Hi,
I created a setup of Outlook Shared Add-in. This setup is running on my all Windows vista System but not in Windows XP System.
i went to tools menu -> Trust center -> add-in then my in my add-in check box, Checked is not appear.
And the following error is showing
"Not loaded. A runtime error occured during loading of the COM Add-in"
I am using outlook 2007
and VS2005
If i m missing something please guide me.
Thanks a lot in advance
Regards
Dharmchand Dhingra
modified on Saturday, August 1, 2009 6:03 AM
|
|
|
|
|
Your add-in did something wrong when it was loaded. Your going to have to go back to the code and try and figure out what that was. With the information you provided - it's impossible to tell you what went wrong.
|
|
|
|
|
Hi Dave Kreskowiak,
Thakns a lot for quick reply.
I m just creating simple application in which i m showing message like msgbox("Startup completed"),
msgbox("Updated...") etc in default share add-in events.
When i build setup of this application and try to run in vista it is working successfully but when try to in XP then it is not loading and showing "Loading Error"
Please suggest
Thanks
Dharmchand Dhingra
|
|
|
|
|
I'm trying to implement something similar to this: Asynchronous socket communication[^]. However, I get an error "No connection could be made because the target machine actively refused it 127.0.0.1:4359" when EndConnect() is called.
Server
Public Sub Start()
Dim EP As New IPEndPoint(IPAddress.Any, Me.Port)
Dim listener As New Socket(EP.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
listener.Bind(EP)
listener.Listen(10)
listener.BeginAccept(New AsyncCallback(AddressOf OnConnectRequest), listener)
End Sub
Private Sub OnConnectRequest(ByVal ar As IAsyncResult)
Dim listener As Socket = DirectCast(ar.AsyncState, Socket)
'(Adds connected client to a list)
listener.BeginAccept(New AsyncCallback(AddressOf OnConnectRequest), listener)
End Sub
Client
Public Sub Connect(ByVal port As Integer)
Dim sock As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim server As New IPEndPoint(IPAddress.Loopback, port)
sock.BeginConnect(server, New AsyncCallback(AddressOf OnConnect), sock)
End Sub
Private Sub OnConnect(ByVal ar As IAsyncResult)
Dim sock As Socket = DirectCast(ar.AsyncState, Socket)
sock.EndConnect(ar) 'Exception is thrown here
'(Handle connection)
End Sub
I ensure that the server is running before the client tries to connect and that the port is set correctly. I also don't think this is a firewall problem, as turning it off hasn't helped at all.
Can anyone help?
|
|
|
|