|
hey, Thank you very much for the reply. This will help alot.
|
|
|
|
|
You're welcome!
Once you get more than a few players, you may want to switch to an array and then use a queue for example to determine who's up next, if it's turn based.
But for 2 players, using dedicated properties makes sense.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I need to call a method (returning void) in an async method.
I have problem with the syntax of the Task.Run() in VB.
I have a working example in C#.
So it's just another: "Parse-this-line-from-C#-into-VB-and-it-should-work".
VB-code
Module Module1
Sub Main()
Console.WriteLine("Start of Run")
Run()
Console.WriteLine("End of Run")
Console.ReadLine()
End Sub
Async Sub Run()
Dim arg = "LEET 1337"
Await Threading.Tasks.Task.Run(Function() Foo(arg))
End Sub
Sub Foo(ByVal asdf As String)
Console.WriteLine("Start of Foo")
Threading.Thread.Sleep(5000)
Console.WriteLine(asdf)
Console.WriteLine("End of Foo")
End Sub
End Module
C#-code
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start Run");
Run();
Console.WriteLine("End of Run");
Console.ReadLine();
}
static async void Run()
{
var arg = "LEET 1337";
await Task.Run(() => Foo(arg));
}
static void Foo(string asdf)
{
Console.WriteLine("Start Foo");
Thread.Sleep(5000);
Console.WriteLine(asdf);
Console.WriteLine("End of Foo");
}
}
}
|
|
|
|
|
|
Of course I have to switch Function() to Sub()
Thank you for the correction!
|
|
|
|
|
Hi sir,
i'm already developement console application using vb.net 2010 and run smoothly in windows 10 / 7 desktop.
Unfortunately when install this console application on my Windows Server 2008 , it running but when to insert into Oracle database 11g R2 it fail.
Already install oracle client 32 / 64 bit on server, when i try to connect using ODBC Administrator it can be done... anyone got idea how to settle this issues? ..
thank you in advance..
|
|
|
|
|
kerek2 wrote: it running but when to insert into Oracle database 11g R2 it fail.
Define "it fail".
|
|
|
|
|
It fail means : cannot insert into Oracle database table. i'm suspect configuration for oracle in my server...any one can guide me plzz..tq
|
|
|
|
|
There's only about two dozen things that can be wrong and without any error messages and the code you're using to insert into the database, it's pretty much impossible to tell you what's going wrong.
|
|
|
|
|
Does it connect to the Oracle DB?
|
|
|
|
|
Yup using Oracle Client 11gR2
|
|
|
|
|
He was referring to your code. Does that connect to the database?
You're not supplying any information about your code and any error messages. That stuff is THE MOST IMPORTANT pieces of information you can supply to get any help from anyone on this.
|
|
|
|
|
So im trying to see if a process is running 2 or more times. So far i can get a boolean if the proccess exists.
For Each proc As Process In Process.GetProcesses
If proc.ProcessName.Contains("testApp") = True Then
Debug.WriteLine("application is running")
End If
Next
already tried
For Each proc As Process In Process.GetProcesses
If proc.ProcessName.Contains("testApp") = True Then
Dim proccount As String = proc.ProcessName.Contains("testApp")
If proccount.Count >= 1 Then
Debug.WriteLine("application is already running")
End If
End If
Next
Well thats not how it works.
|
|
|
|
|
If you are looking for restricting to single instance:
Go to project properties -> application -> Check mark "Make single instance application"
About your approach/ask above, to find all the instances of the process: [http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx](http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx)
Imports System.Diagnostics
Imports System.ComponentModel
Namespace MyProcessSample
Class MyProcess
Sub BindToRunningProcesses()
Dim currentProcess As Process = Process.GetCurrentProcess()
Dim localAll As Process() = Process.GetProcesses()
Dim localByName As Process() = Process.GetProcessesByName("notepad")
Dim localById As Process = Process.GetProcessById(1234)
Dim remoteAll As Process() = Process.GetProcesses("myComputer")
Dim remoteByName As Process() = Process.GetProcessesByName("notepad", "myComputer")
Dim ipByName As Process() = Process.GetProcessesByName("notepad", "169.0.0.0")
Dim remoteById As Process = Process.GetProcessById(2345, "myComputer")
End Sub
Shared Sub Main()
Dim myProcess As New MyProcess()
myProcess.BindToRunningProcesses()
End Sub
End Class
End Namespace
|
|
|
|
|
thank you very much
|
|
|
|
|
I'm trying to wait till the page is loaded and then execute JavaScript but all my attempts are "failing" (its working with a timer).
So far i tried
If Browser.CanExecuteJavascriptInMainFrame Then
End If or
If Browser.IsLoading Then
End If Right now im using a timer to do it.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Browser = New ChromiumWebBrowser("https://example.com")
Form1.Panel1.Controls.Add(Browser)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Browser.IsLoading = True Then
Debug.WriteLine("true")
Else
Dim test As Task(Of JavascriptResponse) = Browser.EvaluateScriptAsync("document.getElementsByTagName('h1')[0].innerText")
Debug.WriteLine(test.Result.Result)
Timer1.Enabled = False
End If
End Sub
but this way it feels just like bad coding and i don't want to do this. Every time i try it another way it will just try it once as its not a loop(tried a loop and i failed as well )
I read the general usage of CefSharp but the problem here is everything is in C# i do understand it but i cant convert it to vb cause my knowledge isn't that great.
|
|
|
|
|
Hi everyone,
In my Gizmox Webgui application (vb code) I have: "Form1" containing an "HtmlBox1" control
In the form I have the following function:
<pre lang="text"></pre>
<PermissionSet (SecurityAction.Demand, Name: = "FullTrust")> _
<System.Runtime.InteropServices.ComVisibleAttribute (True)> _
Public Sub VbHelloWorld ()
MsgBox ("Hello World")
End Sub
In order to call this function from "HtmlBox1.html" I added to the html code of the "HtmlBox1" control the following script:
<script type = 'text / javascript'>
function showVbFunction () {
window.external.VbHelloWorld ();
}
</script>
and the following link:
<body>
<a href='#' onclick='showVbFunction()'> Say Hello World From VB </a>
</body>
When debugging and clicking the link, I get the following error: "window.external.VbHelloWorld is not a function"
The script cannot access the function.
Is there anyone who can help me?
-- modified 22-Oct-20 11:33am.
|
|
|
|
|
This is not the place for technical problems, as it states clearly at teh top of the page.
Post it here:http://www.codeproject.com/Questions/ask.aspx[^] but think first: Remember that we can't see your screen, access your HDD, or read your mind - we only get what you tell us to work from. So write your question based on that!
Explain exactly what you have tried, and where you are stuck. The more accurate you are the better the response.
And please, use the code widget to format your code blocks! It's immediately above the input box you are putting the code in ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hello:
I am trying to connection using old school VBA.
This works in VBA!
connectionString = "Provider=sqloledb;Data Source=w2012;Initial Catalog=M1_SU;User Id=m1view;Password=connect2m1;"
This works in VB.NET, but says the server does not exist or access is denied...
"Provider=sqloledb;Data Source=sage;Initial Catalog=JobSheet;persist security info=True;Integrated Security=SSPI;"
Why would the server be available in VB.NET but not in VBA?
Here's the complete code. I must be missing something..
Sub GetJobs_Click()
Dim connectionString As String
' connectionString = "Provider=sqloledb;Data Source=w2012;Initial Catalog=M1_SU;User Id=m1view;Password=connect2m1;"
connectionString = "Provider=sqloledb;Data Source=sage;Initial Catalog=JobSheet;persist security info=True;Integrated Security=SSPI;"
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim sql As String
sql = "SELECT * From [JobSheet].[dbo].[JobInfo] ORDER BY JobNo "
MsgBox (sql)
cn.connectionString = connectionString
[COLOR="#FF0000"]cn.Open ' ERROR'S HERE[/COLOR]
rs.Open sql, cn, adOpenKeyset, adLockReadOnly, adCmdText
rs.MoveFirst
Do While Not rs.EOF
MsgBox (rs.Fields("JobNo"))
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Thanks!
|
|
|
|
|
"Integrated Security" just means to use the credentials of the account running your code. Unless the SQL Server is setup to accept the users Windows accounts as authentication, Integrated Security won't work.
|
|
|
|
|
Hi All,
I want rating bar in my outlook. I want rating bar to be populated in outlook email which has subject stating Resolved.
So when user select the rating i need reply email back to me can this be done in outlook.
I know this can be done in microsoft forms but i want in outlook email body only
TIA
|
|
|
|
|
Hi sir,
I'm trying to insert datetime value from firebird database into oracle database but got "
ORA-01861: literal does not match format string
i'm using this command :
oracmd.CommandText = "INSERT INTO ASIS.TIMECLOCK_DATA(TD_CARDHOLDER_ID,TD_EVENT_DATE) " & _
" VALUES ('" + IBSSDR.Item("CARDHOLDERID").ToString + "',to_date('" + IBSSDR.Item("EVENTDATE") + "','YYYY-MM-DD HH24:MI:SS'))"
'
When i'm using this command
oracmd.CommandText = "INSERT INTO ASIS.TIMECLOCK_DATA(TD_CARDHOLDER_ID,TD_EVENT_DATE) " & _
" VALUES ('" + IBSSDR.Item("CARDHOLDERID").ToString + "',('" + IBSSDR.Item("EVENTDATE") + "'))"
I got this error :-
ORA-01843: not a valid month
Please anyone can guide me?
Plssss, tq
|
|
|
|
|
|
Did you look at the debug/watch window to see how the SQl text contained in oracmd.CommandText looks like?
Did you try to test this SQL expression in the Oracle DB?
|
|
|
|
|
I don't know Oracle so can only assume your date format string is correct; but:
to_date('" + IBSSDR.Item("EVENTDATE") + "','YYYY-MM-DD HH24:MI:SS') is taking a (presumably) date object IBSSDR.Item("EventDate") and putting it directly into that function via string concatenation. As usual, put breakpoints in place and inspect the value of .CommandText - this will show you how VB has formatted that date field, using its default (local) formatting, as input to the function.
You will most likely need to use some explicit formatting on the VB side to create a string that Oracle will be able to parse into a date.
But, as Richard always says, don't build your SQL by string concatenation - parameterise it.
|
|
|
|