|
I have a setting called bckColor which holds the color for the form I'm using. I want to be able to change that color (and save it) using another page. When the form loads, I use me.backcolor=my.settings.bckColor to set the form's backcolor up.
The issue I am having is that the form doesn't always load the color from the My.Settings location. If I had red in the value, run the program and then stop it, manually change the value to blue and run it again, I get red as my backcolor.
Am I missing any additional setting in the my.setting area? in the form properties?!
Please help me.
Thanks.
|
|
|
|
|
Hi,
Me.BackColor = SomeOtherCode.BackColor is always a bit tricky, because even if you are sure that SomeOtherCode is running when your form loads, SomeOtherCode.BackColor may nevertheless not be in memory at that exact moment. Best is to pass SomeOtherCode.BackColor to a public variable when your application starts, then you can easily change the value of that variable on the fly (if necessary). Then Me.BackColor = PublicVariableMyBackGroundColor should work whenever your form loads.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Sir/Madam,
Can I programically find out whether the particular table exist in the database or not.
My database is MS-Access
I am trying to find the table constructed in the database.
Thanks abd Regards
Pankaj
|
|
|
|
|
just try this
SELECT * FROM MSysObjects
solidIT.de - under construction
Components for Microsoft .Net
audittrail, objectcomparer, deepcopy and much more ...
|
|
|
|
|
Sir/madam,
Thanks for ur kind attention.But how i will get to know that whether that table exist or not.
Thanks and Regards
|
|
|
|
|
no prob
SELECT COUNT(*) AS TABLE_EXISTS FROM MSysObjects WHERE Name = 'Forms'
- and now you only have to replace "Forms" in the where clause with the table you want to check
- if the TABLE_EXISTS field is bigger than 0 (zero) then the table exists otherwise it doesn't
solidIT.de - under construction
Components for Microsoft .Net
audittrail, objectcomparer, deepcopy and much more ...
|
|
|
|
|
Hello All!
I have two applications in a solution. ServerA and ClientB lets say. I need to be able to open a form on ClientB from ServerA. SoI'm using a Filewatch to do this. First I create a file in the watched folder. I'm doing this by a button click event on ServerA.
Dim TimeStamp As String = Guid.NewGuid.GetHashCode<br />
Dim TempFile As String = "C:\PlayC\Qtr2\"<br />
Dim ext As String = ".out"<br />
Dim FileName As String = TempFile & TimeStamp & ext<br />
Dim fs As New FileStream(FileName, FileMode.Create)<br />
fs.Close()<br />
End Sub
The my Filewatch is like this on ClientB.
AddHandler NKWatch.Created, AddressOf NKWatch_Created<br />
Try<br />
NKWatch.Path = "C:\PlayC\Qtr2"<br />
NKWatch.Filter = "*.out"<br />
'' NKWatch.IncludeSubdirectories = False<br />
NKWatch.EnableRaisingEvents = True<br />
Catch ERR As Exception<br />
MessageBox.Show(ERR.Message)<br />
End Try
Then the response once a file gets created in the folder.
Public Sub NKWatch_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)<br />
Dim frmFour As New frm4th<br />
<br />
Me.Hide()<br />
frmFour.Show()<br />
frmFour.GetUID(Me)<br />
Application.DoEvents()<br />
End Sub
So when my form shows up, it displays, but then freezes up on me. I use to get a white screen when the form came up, but I put in Application.DoEvents, and that seem to help.
I even tried just a plain form with a couple of buttons.
But if I try a message box, it works perfect.
Am I missing something? Any thougts on this, and how I may get this to work? I try to get debug it, but I can't find anything. The server A form is pretty simple, the clientB form has alot of stuff going on, that why I tried a simple blank form. But the same results.
I have two clientB forms, prety much the same, except diffrent labels for the buttons.
Thanks!
Rudy
|
|
|
|
|
Hi Rudy,
I have had problems myself with hiding and showing forms, and I found that me.hide() sometimes seems to act a little like me.close() , and therefore doesn't always nicely handle subsequent code.
rudemusik wrote: Public Sub NKWatch_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
Dim frmFour As New frm4th
Me.Hide()
frmFour.Show()
frmFour.GetUID(Me)
Application.DoEvents()
End Sub
Just a wild guess, but you could try to move Me.Hide() after Application.DoEvents()
If it doesn't help, it shouldn't hurt either.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Johan!
I tried that. I even tried just to show the form, without hiding it. Same thing. Still trying to figure it out.
Thanks for the reply!
Rudy
|
|
|
|
|
Dear all,
Some of most popular program (e.g., meetro) has no proxy setting.
I want to use that program with proxy server. But I don't know how to redirect IP
to proxy server. Can I developed a program with VB for that problem?
Please help me...
(stup!x...)
|
|
|
|
|
Well, how this is done depends on the application. There's two possibilities.
The first is if you can change the IP that your application is using. If so, then you have to write your proxy server as both a server AND a client for the kind of server that your app attaches to. The server accepts the connection from the application and forwards the request to the REAL server the application was trying to connect to. This forwarder is actually a client of the REAL server. The response comes back from the server and the client side forwards the responds to your proxy's server side. Get it?
Now, if you can't change the IP the app uses, you have a MUCH more difficult problem. Now, instead of a proxy server, you're stuck writing a packet sniffer, just like any network protocol analyzer. You have to use a 3rd party library, like WinPcap, to capture the packets as they go down the network stack, modify the packets to redirect them to a new server IP.
Since your even asking this question, and the language you've picked for it, tells me that you have a very limitied knowledge of how TCP/IP communication works. Make no mistake, both of these projects require an ADVANCED level of knowledge of how your application works and how IP communication works.
No, I don't have an example of either of these types of apps.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you for your answer DAVE.
(stup!x...)
|
|
|
|
|
Hello,
I want to hide a column in a datagrid.
This is my code below that works, but isn't there a better way to do this.
<br />
ds = objComponents.RefComponentsTypes_selAll()<br />
Me.dgvComponents.DataSource = ds.Tables(0)<br />
Me.dgvComponents.Columns("AssemblyID").Width = 0<br />
Thanks in advance,
Steve
|
|
|
|
|
You can set the width to zero.
Or you can just delete the column all-together.
Or you can get a new view of the DataSet and not include that column in the view, then bind the DataGridView to the new DataView.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi
i m using datagirdview in my vb.net(winforms)-2005 application.
i m validating each cell in "datagridview_CellValidated" procedure. and after validating each cell i wnt to set focus on that cell so i wrote following code in above procedure but it doesnt set focus on that cell to which im validating.
code----->
DGCustDept.CurrentCell.DataGridView.Focus()
or
Me.DGCustDept.CurrentCell = New DataGridCell(e.rowindex, e.columnindex)
Please tell me wht shuld i do?
priya
|
|
|
|
|
control.column(0).visible=true/false
|
|
|
|
|
Please don't tell me that this should be sending off red lights, but I need to know how to declare "global" variables (where, and how). I am using Visual Basic.net Express Edition... If this has any effect on it. Anyways, I have two forms, and I need to have the variables from one accessible to the other. Any help you can give me would be appreciated.
|
|
|
|
|
jacob.vankley wrote: Please don't tell me that this should be sending off red lights
OK. It should, tho
jacob.vankley wrote: but I need to know how to declare "global" variables
You can't. You can create a class with public, static properties, tho.
jacob.vankley wrote: Anyways, I have two forms, and I need to have the variables from one accessible to the other.
Then globals are the wrong approach (as is often true ). You should define delegates that pass the info between forms as it changes. Or, if you're only passing from parent to child, add properties on the child that the parent can set.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Alright, i think i understand, i will try that.
|
|
|
|
|
It's a common question, I keep meaning to write an article on it. If you get stuck, just ask again.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
I thought I'd do one that goes over all the things I see people trying to do in the forums, and why they are all bad.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian Graus wrote: I thought I'd do one that goes over all the things I see people trying to do in the forums, and why they are all bad.
Ah... It reminds me of a session I attended at the DDD4 conference last month. "How to write crap C# code" - It was surprisingly well attended.
|
|
|
|
|
jacob.vankley wrote: I need to know how to declare "global" variables
jacob.vankley wrote: I have two forms, and I need to have the variables from one accessible to the other.
That is no reason to use global variables.
jacob.vankley wrote: Please don't tell me that this should be sending off red lights
Well... It seems you already know it is a bad idea.
Perhaps your question should have been: I need to share information between two forms. Is there any way to do this without using global variables? If so, how?
To which my answer would have been: Read this article[^] about passing variables between forms. It was written for VB.NET 1.1 but it should still be valid for 2.0
|
|
|
|
|
Thanks so much! I will try that, and it should work.
|
|
|
|