|
Shared (Static in C#) methods don't belong to any instance of a class, so there is no constructor to call...
When calling a Shared method, you do not have to create an instance of the class that's hosting the method. You just call it! For instance, the Environment[^] class is full of Shared methods. You can call any of them at any time, without creating an instance of the Environment class first:
Dim myPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
how to upload files into webserver that is in to our project folder
thanks..
|
|
|
|
|
A little searching of the articles goes a long way!
File Upload with ASP.NET
[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As the title, any method to do so?
|
|
|
|
|
use this
DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.ttt")
|
|
|
|
|
What's a minisecond?? I take it you're talking about a millisecond?
The DateTime structure can only return the time accurate to about 10 milliseconds on an NT Kernel machines and about 55 milliseconds on Win9x, no greater. This is because of system timer limitations, not because of any bug in the .NET Framework.
What are you trying to do with such an accurate time?
You can get the current time, down to the approximate millisecond, with:
Dim currDateTime As DateTime = DateTime.Now()
Debug.WriteLine( String.Format("Current Time: {0}", currDateTime.ToLongTimeString) )
Debug.WriteLine( String.Format("Current Milliseconds: {0}", currDateTime.Millisecond) )
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The Top and Left properties are the coordinates of the control.
---
b { font-weight: normal; }
|
|
|
|
|
Can anyone please help me by providing any url/resources where i can get help to understand developing & designing a project in vb.net using oop and also data connectivity.
|
|
|
|
|
|
If you want a really ambitious framework try Rocky Lhotka's "VB .NET Business Objects" book.
http://lhotka.net/[^]
Kevin
|
|
|
|
|
is it a problem if contain too much label will make the system lagging?
i have 400 label actually cause i doing a game want to move the token at specific direction. And i using 3 timer also on dice and movement.
if tis the reason make the system run slow?
|
|
|
|
|
Your question doesn't make any sense, but...
If you're moving 400 labels around or are waiting for 400 labels to paint themselves, you'll be waiting a long time. So, yes, it's possible that this is what's causing your app to lag.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
actually the label were fix in the location whic i dont move it.
but i will move the image to the according label, like when i want to move it to label1 or label 100.
u think that cause lag also?
|
|
|
|
|
Without seeing or knowing anything of your code, it's impossible to say what's lagging...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is it, first i create 400 label for each player to move to it own position, the checkplayerpos() is i set the position where i locate it in my design form there, the timer2() is where i use timer to move around the token one by one according to their dice value from 1-6
------------------
Public Sub checkplayerpos()
If PTurn.Text = 1 Then
z = 1000
ElseIf PTurn.Text = 2 Then
z = 2000
ElseIf PTurn.Text = 3 Then
z = 3000
ElseIf PTurn.Text = 4 Then
z = 4000
End If
End Sub
------------------------------
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
'Control array
Dim squarelabel As Label() = ControlArrayUtils.getControlArray(Me, "Label")
Dim PlayerP As PictureBox() = ControlArrayUtils.getControlArray(Me, "Player")
Dim Ppos As Label() = ControlArrayUtils.getControlArray(Me, "PP")
Dim com As Label() = ControlArrayUtils.getControlArray(Me, "com")
'Get the value whos turn at PTurn.text label
Turn = PTurn.Text
'Get Current Player position
x = Ppos(Turn).Text
checkplayerpos()
'Move Piece 1 by 1
If dicelabel.Text = 1 Then
On Error Resume Next
Static AA As Integer
If AA > 100 Or AA < 1 Then AA = 1
Select Case AA
Case 1
soundmovement()
PlayerP(Turn).Top = squarelabel(z + x + 1).Top
PlayerP(Turn).Left = squarelabel(z + x + 1).Left
AA = 1
PlayerP(Turn).Enabled = False
x = x + 1
'Show player position
Ppos(Turn).Text = x
Check()
'Move to next player
NextPlayerTurn()
Dice.Enabled = True
Timer2.Enabled = False
End Select
ElseIf dicelabel.Text = 2 Then
On Error Resume Next
Static BB As Integer
If BB > 100 Or BB < 1 Then BB = 1
Select Case BB
Case 1
soundmovement()
PlayerP(Turn).Top = squarelabel(z + x + 1).Top
PlayerP(Turn).Left = squarelabel(z + x + 1).Left
BB = 2
Case 2
soundmovement()
PlayerP(Turn).Top = squarelabel(z + x + 2).Top
PlayerP(Turn).Left = squarelabel(z + x + 2).Left
BB = 1
PlayerP(Turn).Enabled = False
x = x + 2
Ppos(Turn).Text = x
Check()
NextPlayerTurn()
Dice.Enabled = True
Timer2.Enabled = False
End Select
ElseIf dicelabel.Text = 3 Then
.....
ElseIf dicelabel.Text = 4 Then
.....
ElseIf dicelabel.Text = 5 Then
.....
ElseIf dicelabel.Text = 6 Then
....
End Sub
------------------
~Thank you so much for helping me out~
|
|
|
|
|
Pardon me for saying so, but this is spaghetti code. Your code could be doggin' in a variety of places. The ControlArray stuff, but more than likely because you're moving controls around your form. Depending on what's around the point where the control WAS and where it goes TO, and if any of these controls overlap other controls, and if you have an image as a background behind these controls, you could be forcing an abnormally high number of controls to repaint.
Basically, may general rule of thumb is if you have to have more than 20-30 controls on a form to do what you want, you really need to rethink how your presenting the user an interface. You could GREATLY increase the performance of your app by not using all these controls and just painting the interface yourself with small bitmaps. But, this would require a rewrite of most of your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
yes i feel that so also... but limit knowleadge on vb.net... there are ppl suggest me to use the x,y coordinate to replace the player token which i only need 100 label instead of the 400 label to place the player position...but i will leave firsr when i have the time will try modify it. Can u help me look at this area? which i cant run my subgame properly
http://www.codeproject.com/script/comments/forums.asp?forumid=1646#xx1414125xx[^]
|
|
|
|
|
I don't have the time to be rewriting someones code. On top of that, I get the feeling this is homework or something else for a class.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
oh i think u have misunderstand my meaning i mean pls help me check on my other problem which about other things not to rewrite the code. but anyway i already found out the solution. thanks for ur time.
|
|
|
|
|
On instantiation, web site loads a java applet. I need to wait until the applet if fully loaded before I can LogIn. I can set the cursor to the correct Window position for LogIn, but it arrives before the applet finishes. I am also unable to make the LogIn box accept the Left_Key_Down/Up and the eventual UserId, Password.
WebPageLoader URLWeb ' Navigates to the web<br />
<br />
Sleep 6000 <br />
<br />
Dim LTime As Date<br />
LTime = Now()<br />
While Time - LTime > 20<br />
DoEvents:(<br />
Wend<br />
<br />
'this happens before the web page loads, the page loads in about 5 seconds!!!<br />
' X/Y need to be passed as Pixels!<br />
xPos = (WebBrowser.Left + 0.9 * WebBrowser.Width) / Screen.TwipsPerPixelX<br />
yPos = (WebBrowser.Top + 0.5 * WebBrowser.Height) / Screen.TwipsPerPixelY<br />
<br />
' Move cursor to destination, first<br />
SetCursorPos xPos, yPos: Sleep 500<br />
MousePointer = vbArrow<br />
<br />
'Map into same coordinate space used by mouse_event.<br />
xPos = (xPos / GetSystemMetrics(SM_CXSCREEN)) * &HFFFF&<br />
yPos = (yPos / GetSystemMetrics(SM_CYSCREEN)) * &HFFFF& <br />
<br />
If Me.WindowState = vbMinimized Then Me.WindowState = vbNormal<br />
Me.SetFocus<br />
<br />
Dim hWnd As Long<br />
'hWnd = GetForegroundWindow()<br />
hWnd = WebBrowser.hWnd<br />
<br />
'here are 3 methods that I have tried<br />
Call mouse_event(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_ABSOLUTE, xPos, yPos, 0, 0)<br />
Sleep 250<br />
Call mouse_event(MOUSEEVENTF_LEFTUP Or MOUSEEVENTF_ABSOLUTE, xPos, yPos, 0, 0)<br />
Sleep 250<br />
<br />
Dim lng As Long<br />
lng = SendMessageVal(hWnd, MOUSEEVENTF_LEFTDOWN, 1, 0)<br />
lng = SendMessageVal(hWnd, MOUSEEVENTF_LEFTUP, 1, 0)<br />
<br />
'lng = Send_Key_Code(MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_ABSOLUTE, lHandle, False, False, False)<br />
'lng = Send_Key_Code(MOUSEEVENTF_LEFTUP Or MOUSEEVENTF_ABSOLUTE, lHandle, False, False, False)<br />
<br />
SendKeys "xxxx@yahoo.com", True: Sleep SleepTime 'UserID<br />
SendKeys (vbTab), True: Sleep SleepTime<br />
SendKeys "xxxxx", True: Sleep SleepTime 'password<br />
SendKeys vbCr, True
"Good software like good food takes time to prepare"
Winnie-the-Pough"
|
|
|
|
|
Hi,
I have a VB Project that needs Unicode support. I use Textbox, listview, treeview,and labels. I replaced the default textbox with Microsoft forms2.0 object library's textbox in the application, but this too fails to display many of the characters.There are no Treeview and Listview in Microsoft forms2.0 object library. Someone please help me.
Thanks & Regards
Ranjan
|
|
|
|
|
Ummm....Everything in VB is stored in Unicode. Could it be that the characters you're trying to display don't exist in the font that your using?
Which VB are you using? What's the O/S on the machine? It could also be that your O/S doesn't support it. Win9x installations had to have Unicode support added to the O/S after installation...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I am developing a project in vb.net. So, I have made login screen. After the user is validated, I need to open the next screen. I am using the code like:
Dim AdminPage As New frmMDI
AdminPage.Show()
Me.Dispose()
This piece of code works fine in the other vb.net project. But here, after the user is validated, instead of opening the next page, the project stops running. Even in the debug mode also, I am unable to find out the problem as the program stops running. So, please let me know, how can I solve this problem?
With Regards,
Sheshadrinath.R
|
|
|
|
|
Dim AdminPage As New frmMDI
AdminPage.Show()
Me.Dispose()
u may have current form as start up page (Me) so when u say Me.Dispose() then ur application get Dispose bcoz ur main from of application is current form(Me)
so inted of Me.Dispose() use Me.Hide()
it will solve the problem
if u have some prob with that plz reply me on my id
harshad_pednekar@yahoo.com
Regards
Harshad
|
|
|
|
|
Your startup form should be the main application form, not the LoginForm.
You're main form should start up, check some flag to see if the user is logged in, and if not, show the login form. If the login is successful, you can finish starting up your main form. If not, the main form can kill itself and shutdown your app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|