|
I have a table in sql server with around 26 fields my problem is i don't know the best way to go about updating these 26 fields. I thought of creating a link from my existing datagrid to a webform and populating the form with the existing row's details and updating this way. If you have any better suggestions please help.
don't let the game play you, play the game
|
|
|
|
|
You want to save changes, or new values ? Either way, the best way is always to use a stored procedure, and call it. I would use a create/edit page that shows the details of one record, which can be selected from the datagrid.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I would like to create a linkedlist with a very very large amount of nodes.
Thus, I thought of using the swap file memory to avoid to crash my pc.
Anyone could give me some exemple to manage the swap in vb.net ?
Or give me some way to do this ?
Thanks
|
|
|
|
|
TheDarkMan wrote:
Anyone could give me some exemple to manage the swap in vb.net ?
You don't. The memory management system in Windows manages what parts of memory go to the swap file and what parts are in physical RAM - you do not have control of this.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I would like to use the API VirtualAlloc,VirtualFree,...
No possible with those functions ?
|
|
|
|
|
This is completely uneccessary. You COULD do this, but these functions allocate UNMANAGED memory. You'll also have to write code to move your data back and forth between the managed and unmanaged world, slowing down your performance.
Believe me, what you are thinking of doing is not a good idea and a waste of time. I've used huge arrays of objects (2 Billion elements) before, using about 2GB of memory, without any problems.
Try it using normal methods before you start trying to code this. What you should be thinking about is how swapping to disk and back is going to affect your performance. This is something you'll have to deal with even if you do go through your VirtualAlloc method.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In fact, i would like to this because i read articles on iocp completion port (almost all in c++) and i found this articles very interresting :
http://www.codeproject.com/useritems/IOCPNet.asp
And this person use a linkedlist with virtual memory to avoid
The WSAENOBUFS error problem.
explained at this article : http://www.codeproject.com/internet/IOCP_Server_client.asp"
But for my project i must only use vb.net (client spec). So i tried to rewrite the linkedlist and preallocator object of the first article but it's not easy.
Do you see my problem ? Maybe there are managed functions which will do the same things but i don't them ?
|
|
|
|
|
Considering that the articles client and server is written entirely in unmanaged C++, I fail to see how using the managed libraries, instead of the API functions directly, to implement your client and server would directly relate to this article.
My best recommendation would be to write a test implementation in VB.NET to see if this issue is going to apply to your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your recommandation. I will try.
But i inform you that i think that i have successfully rewrited the class OLinkedList, OPreallocator and SafeLock in VB.net.
I do just some tests for now and if it works. I will post my code.
But your are right in managed code is not possible. The virtual function aren't implemented in framework. Thus in use the API.
|
|
|
|
|
Hi guys,
I just spent about 4 hours of searching for how to make a deep copy of a datagrid.
I tried to serialize it, but its marked as being unserializable.
I also read about manual cloning (like implementing the ICloneable interface) but didn't get the clue.
So theres a third option I already read of:
Creating a new class, which inherits the datagrid and provides a new method (named deepcopy() or whatever), whichs task ist to create a new instance of a datagrid and transfers all the properties/variables/objects of the sourcedatagrid and finally returns the new instance. since the datagrid isn't a small class, it would take a long time to write this method. since you could use this method for datagrids only, it would be very inefficient. So here's the question:
Is there any possibility to write a clone-function which creates a deep copy and works for every kind of object?
thanks in advance,
mik
*edit* i also read something about reflection but the english was too difficulty to read, so i didn't get the point :/ if that could be a solution i would be pleased about any links to a nice explanation
-- modified at 6:08 Thursday 8th September, 2005
|
|
|
|
|
Hi
In vb6 I want to have an activex-exe file that the user can also run it as an ordinary executable file. So I put a Sub Main() in that which loads the GUI. But a new problem raises here, which is when I am going to create an instance of any class in that activex-exe, the Sub Main() runs before the Class_Initialize() and the GUI also is shown (which is not what I want when creating an instance of the class).
How could I overcome this problem?
|
|
|
|
|
I would have a separate EXE for this purpose which uses the ActiveX EXE to expose the functions to a GUI. Don't try to make the ActiveX EXE serve two purposes.
...Steve
|
|
|
|
|
hi,every one:
i write a program to scan a special folder every 10 second.so i drag a timer control to the from. and in timer1_tick sub i write some code.it work very well under by windos xp system. but when i put the program onto another server(system is windows 2003 server),i found the timer control is NOT run,even 1 time.
so i delete the timer control,create a threading.timer object used code under:
dim tmr as threading.timer=new threading.timer(new threading.timercallback(addressof timerproc,vbnull,0,10000)
i found the sub NOT work still.
help,what's the matter?
thx.
|
|
|
|
|
|
Hey, you only left this message a few hours ago. Don't be impatient. If you want instant response I'm sure that there are many consultants that would be willing to help for a fee Remember this is a free site.
As to your question, if you can post the code which you are using we can have a look see at what the problem might be.
...Steve
|
|
|
|
|
following is the code. there is some chinese words,but it is not important. and i give the mainly meaning . thanks for help me! i can't find error in it.
Public Class Form1<br />
<br />
Inherits System.Windows.Forms.Form<br />
Dim PathString As String = System.Windows.Forms.Application.StartupPath & "\", PL() As PlugStructure<br />
Dim StartTime As Date = Now<br />
Dim Tcb As Threading.TimerCallback<br />
Dim Tmr As Threading.Timer<br />
<br />
Structure PlugStructure<br />
Dim Name As String<br />
Dim Guid As String<br />
Dim Status As PlugStatus<br />
Dim Ins As PlugIns.piInterface<br />
Dim Tab As TabPage<br />
Dim Txt As TextBox<br />
End Structure<br />
<br />
Enum PlugStatus<br />
Loaded = 0<br />
Starting = 1<br />
Running = 2<br />
Stopping = 3<br />
Stopped = 4<br />
Unloaded = 5<br />
End Enum<br />
<br />
#Region " Windows 窗体设计器生成的代码 " ' this means code generation by windows form designer<br />
<br />
Public Sub New()<br />
MyBase.New()<br />
<br />
InitializeComponent()<br />
<br />
End Sub<br />
<br />
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)<br />
If disposing Then<br />
If Not (components Is Nothing) Then<br />
components.Dispose()<br />
End If<br />
End If<br />
MyBase.Dispose(disposing)<br />
End Sub<br />
<br />
Private components As System.ComponentModel.IContainer<br />
<br />
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl<br />
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage<br />
Friend WithEvents TxtMain As System.Windows.Forms.TextBox<br />
Friend WithEvents RightClick As System.Windows.Forms.ContextMenu<br />
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon<br />
Friend WithEvents ShowMain As System.Windows.Forms.MenuItem<br />
Friend WithEvents NoUse As System.Windows.Forms.MenuItem<br />
Friend WithEvents EndProgram As System.Windows.Forms.MenuItem<br />
Friend WithEvents PnlRunTime As System.Windows.Forms.StatusBarPanel<br />
Friend WithEvents PnlRoundTimes As System.Windows.Forms.StatusBarPanel<br />
Friend WithEvents PnlPlugIns As System.Windows.Forms.StatusBarPanel<br />
Friend WithEvents STBInfo As System.Windows.Forms.StatusBar<br />
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<br />
Me.components = New System.ComponentModel.Container<br />
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))<br />
Me.TabControl1 = New System.Windows.Forms.TabControl<br />
Me.TabPage1 = New System.Windows.Forms.TabPage<br />
Me.TxtMain = New System.Windows.Forms.TextBox<br />
Me.RightClick = New System.Windows.Forms.ContextMenu<br />
Me.ShowMain = New System.Windows.Forms.MenuItem<br />
Me.NoUse = New System.Windows.Forms.MenuItem<br />
Me.EndProgram = New System.Windows.Forms.MenuItem<br />
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)<br />
Me.STBInfo = New System.Windows.Forms.StatusBar<br />
Me.PnlRunTime = New System.Windows.Forms.StatusBarPanel<br />
Me.PnlRoundTimes = New System.Windows.Forms.StatusBarPanel<br />
Me.PnlPlugIns = New System.Windows.Forms.StatusBarPanel<br />
Me.TabControl1.SuspendLayout()<br />
CType(Me.PnlRunTime, System.ComponentModel.ISupportInitialize).BeginInit()<br />
CType(Me.PnlRoundTimes, System.ComponentModel.ISupportInitialize).BeginInit()<br />
CType(Me.PnlPlugIns, System.ComponentModel.ISupportInitialize).BeginInit()<br />
Me.SuspendLayout()<br />
'<br />
'TabControl1<br />
'<br />
Me.TabControl1.Appearance = System.Windows.Forms.TabAppearance.FlatButtons<br />
Me.TabControl1.Controls.Add(Me.TabPage1)<br />
Me.TabControl1.Location = New System.Drawing.Point(24, 16)<br />
Me.TabControl1.Name = "TabControl1"<br />
Me.TabControl1.SelectedIndex = 0<br />
Me.TabControl1.Size = New System.Drawing.Size(648, 24)<br />
Me.TabControl1.TabIndex = 0<br />
'<br />
'TabPage1<br />
'<br />
Me.TabPage1.Location = New System.Drawing.Point(4, 24)<br />
Me.TabPage1.Name = "TabPage1"<br />
Me.TabPage1.Size = New System.Drawing.Size(640, 0)<br />
Me.TabPage1.TabIndex = 0<br />
Me.TabPage1.Tag = "Main"<br />
Me.TabPage1.Text = "Main Form"<br />
'<br />
'TxtMain<br />
'<br />
Me.TxtMain.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _<br />
Or System.Windows.Forms.AnchorStyles.Left) _<br />
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)<br />
Me.TxtMain.Location = New System.Drawing.Point(24, 40)<br />
Me.TxtMain.Multiline = True<br />
Me.TxtMain.Name = "TxtMain"<br />
Me.TxtMain.ReadOnly = True<br />
Me.TxtMain.Size = New System.Drawing.Size(648, 184)<br />
Me.TxtMain.TabIndex = 0<br />
Me.TxtMain.Text = ""<br />
'<br />
'RightClick<br />
'<br />
Me.RightClick.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.ShowMain, Me.NoUse, Me.EndProgram})<br />
'<br />
'ShowMain<br />
'<br />
Me.ShowMain.DefaultItem = True<br />
Me.ShowMain.Index = 0<br />
Me.ShowMain.Text = "Show Me"<br />
'<br />
'NoUse<br />
'<br />
Me.NoUse.Index = 1<br />
Me.NoUse.Text = "-"<br />
'<br />
'EndProgram<br />
'<br />
Me.EndProgram.Index = 2<br />
Me.EndProgram.Text = "Quit"<br />
'<br />
'NotifyIcon1<br />
'<br />
Me.NotifyIcon1.ContextMenu = Me.RightClick<br />
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)<br />
Me.NotifyIcon1.Text = "AutoTask"<br />
Me.NotifyIcon1.Visible = True<br />
'<br />
'STBInfo<br />
'<br />
Me.STBInfo.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _<br />
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)<br />
Me.STBInfo.Dock = System.Windows.Forms.DockStyle.None<br />
Me.STBInfo.Enabled = False<br />
Me.STBInfo.Location = New System.Drawing.Point(0, 232)<br />
Me.STBInfo.Name = "STBInfo"<br />
Me.STBInfo.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.PnlRunTime, Me.PnlRoundTimes, Me.PnlPlugIns})<br />
Me.STBInfo.ShowPanels = True<br />
Me.STBInfo.Size = New System.Drawing.Size(696, 22)<br />
Me.STBInfo.TabIndex = 1<br />
Me.STBInfo.Text = "StatusBar1"<br />
'<br />
'PnlRunTime<br />
'<br />
Me.PnlRunTime.Alignment = System.Windows.Forms.HorizontalAlignment.Center<br />
Me.PnlRunTime.Icon = CType(resources.GetObject("PnlRunTime.Icon"), System.Drawing.Icon)<br />
Me.PnlRunTime.Text = "0D 0H 0M"<br />
Me.PnlRunTime.Width = 90<br />
'<br />
'PnlRoundTimes<br />
'<br />
Me.PnlRoundTimes.Alignment = System.Windows.Forms.HorizontalAlignment.Center<br />
Me.PnlRoundTimes.Icon = CType(resources.GetObject("PnlRoundTimes.Icon"), System.Drawing.Icon)<br />
Me.PnlRoundTimes.Text = "0"<br />
Me.PnlRoundTimes.Width = 80<br />
'<br />
'PnlPlugIns<br />
'<br />
Me.PnlPlugIns.Icon = CType(resources.GetObject("PnlPlugIns.Icon"), System.Drawing.Icon)<br />
Me.PnlPlugIns.MinWidth = 1<br />
Me.PnlPlugIns.Width = 510<br />
'<br />
'Form1<br />
'<br />
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)<br />
Me.ClientSize = New System.Drawing.Size(696, 254)<br />
Me.Controls.Add(Me.STBInfo)<br />
Me.Controls.Add(Me.TabControl1)<br />
Me.Controls.Add(Me.TxtMain)<br />
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)<br />
Me.MaximizeBox = False<br />
Me.MinimizeBox = False<br />
Me.Name = "Form1"<br />
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen<br />
Me.Text = "AutoTask"<br />
Me.TabControl1.ResumeLayout(False)<br />
CType(Me.PnlRunTime, System.ComponentModel.ISupportInitialize).EndInit()<br />
CType(Me.PnlRoundTimes, System.ComponentModel.ISupportInitialize).EndInit()<br />
CType(Me.PnlPlugIns, System.ComponentModel.ISupportInitialize).EndInit()<br />
Me.ResumeLayout(False)<br />
<br />
End Sub<br />
<br />
#End Region<br />
<br />
Private Sub TimerProc(ByVal state As Object)<br />
Tmr.Change(Threading.Timeout.Infinite, Threading.Timeout.Infinite)<br />
....<br />
Tmr.Change(10000, 10000)<br />
End Sub<br />
<br />
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Tcb = New Threading.TimerCallback(AddressOf TimerProc)<br />
Tmr = New Threading.Timer(Tcb, vbNull, 1000, 10000)<br />
Me.NotifyIcon1.Visible = True<br />
Me.WindowState = FormWindowState.Minimized<br />
Me.ShowInTaskbar = False<br />
LogMain("Program Start at:" & PathString)<br />
End Sub<br />
<br />
Private Sub LogMain(ByVal S As String)<br />
Me.TxtMain.Text = Now & ": " & S & vbCrLf & Me.TxtMain.Text<br />
End Sub<br />
<br />
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged<br />
Dim t As TextBox<br />
For Each t2 As Object In Me.Controls<br />
If Equals(t2.GetType, GetType(TextBox)) Then<br />
t = CType(t2, TextBox)<br />
If t.Name <> "Txt" & Me.TabControl1.SelectedTab.Tag Then<br />
t.Visible = False<br />
Else<br />
t.Visible = True<br />
End If<br />
End If<br />
Next<br />
End Sub<br />
<br />
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing<br />
e.Cancel = True<br />
Me.WindowState = FormWindowState.Minimized<br />
Me.ShowInTaskbar = False<br />
Me.NotifyIcon1.Visible = True<br />
End Sub<br />
<br />
Private Sub EndProgram_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles EndProgram.Click<br />
If Not PL Is Nothing Then<br />
For i As Integer = 0 To PL.GetUpperBound(0)<br />
PL(i).Ins.EndNow()<br />
Next<br />
End If<br />
Me.NotifyIcon1.Visible = False<br />
Tmr.Change(Threading.Timeout.Infinite, Threading.Timeout.Infinite)<br />
Tmr.Dispose()<br />
End<br />
End Sub<br />
<br />
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick<br />
ShowMain_Click(sender, e)<br />
End Sub<br />
<br />
Private Sub ShowMain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShowMain.Click<br />
Me.WindowState = FormWindowState.Normal<br />
Me.ShowInTaskbar = True<br />
Me.NotifyIcon1.Visible = False<br />
End Sub<br />
<br />
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize<br />
If Me.STBInfo.Width > 300 Then Me.STBInfo.Panels(2).Width = Me.STBInfo.Width - Me.STBInfo.Panels(0).Width - Me.STBInfo.Panels(1).Width<br />
End Sub<br />
End Class
|
|
|
|
|
I'd make the following changes to the code:
1. delete the Tmr.Change() lines from your timer callback. They serve no purpose in the callback function.
2. Change this line:
Tmr = New Threading.Timer(Tcb, vbNull, 1000, 10000)
to this...
Tmr = New Threading.Timer(Tcb, Nothing, 1000, 10000)
because vbNull is not the same as Nothing in VB.
...Steve
|
|
|
|
|
thank you for reply again.
i write tmr.change in my timer callback procedure because i am afraid of this procedure will not finish in 10 second,i think this can prevent it.
and i accept the No.2
but the original problem is i'm using a system.windows.form.timer control,and it NOT work normal also. would you like explain the reason to me?following is the original code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
....<br />
End Sub
|
|
|
|
|
Silly question, but is the timer enabled (in my own form initialization code I have something like this):
Timer1.Enabled = False
Timer1.Interval = 2000
Timer1.Enabled = True
Another possibility is that the Timer control is designed only for use with forms. Is the form on which it appears always active? It could also be the version of the .NET Framework you have on the server vs the one you have compiled against on your workstation. Check that they match.
...Steve
|
|
|
|
|
i am not a proficient programmer,but i am not a beginner too.
"timer1.enable=true " has in form1_load already.
the form will minimized once it start,do this affect the timer and lead the timer deactive? if so,many question will occur...
and the timer is used in a winform,i am sure this.
No.3,both the server and my machine has the same version of .NET(1.1.4322).
sigh.....
|
|
|
|
|
woodwell wrote:
i am not a proficient programmer,but i am not a beginner too.
I'm not trying to be funny - sometimes the answers lie in the most simple of overlooked things.
Well assuming that the code works fine on your WinXP box and the same code does not work on Win2k3 Server (hazarding to state the obvious here...) there is something different about that environment.
Are there any error messages trapped by your code that could give us a clue? If not, ensure that the timer control OCX/DLL or whatever is actually on the server and registered. Also check that the service pack on your VB (Visual Studio .NET 200x?) is up to date.
...Steve
|
|
|
|
|
i know that. sorry for my misnomer.
this program work very well on my XP machine, no any error or warning message. but on Win2003 PRO server,it strike.
i remember one thing, two weeks ago, there is another program which used timer control too, run normal on this server. since i found this problem yesterday, i ask the administrator of our LAN, he said,the server has no any change for 2 months at least.
it looks that problem is base on two diffirent environment. i think so yesterday, but i has no resolvent.
|
|
|
|
|
Hello Folks!
I am developing one application in which I have to do the scanning of the document.I have implemented that through the imagescan.ocx control.I am able to scan the document but it is not displayed in the image edit control and it is not even showing any error.
I am a bit confused regarding this.
Can anybody help me out in this regard.
Waiting for your reply.
Thanking you.
Regards,
Krsna.
|
|
|
|
|
I've developed an application in VB6 to communicate with an RS232 device controled with motorola HC11. However one of the routines in my application needs to send and intel hex file to the motorola which it will process and load into flash memory for software upgrades. The HC11 is sending Xon/Xoff characters to indicate when its buffer is full but I can't seem to react quick enough with the mscomm control to prevent buffer overrun. It will work at a dreadfully slow pace but I need more speed. I know that mscomm has a handshaking property but I'm not sure how to use it to stop my data transfer. Any help would be appreciated.
|
|
|
|
|
Hi friends!
This might sound really elementary but i was just wondering how can i make sure that a user inputs an integer value. I've a textbox which has to be in integer format and when it is not, upon clicking the save button, my field validator should shows up and resets the textbox to "". I've tried this code but it doesn't seem to work...
If Cint(TextBox1.Text) = false then
RFV1.Validate()
TextBox1.Text = ""
Else
'does the saving
End If
It throws an exception that input string is not in correct format. How do i go about fixing this? Thanx to all!
Kampai!!!
|
|
|
|
|