|
That is essentially what I already have with the exisitng tables. Of course there is a lot more information in each table, the well table contains cost center codes, subdivision, longitute and lattitude and is a many to one relationship with the Lease table. The Locations table which I switched and tried to add to the well table still has a cost center and the address of the Location I have placed in the longitude/lattitude fields with the name of the storage yard in the Well field
When I had both tables no problem pulling out the well (which is actually the well number in the particular lease generally coded like: 12-34, 9-1, or 7-50- this relates to the location on a acre gridlines which each square mile of oil field leases are divided into) or the location from the location table. It always seemed to succeed when I went from well to storage or storage to well. But well to well or storage to storage I never got any data - though I have manually created the data so I know I have records for testing purposes.
I was thinking I needed to add something like:
w.well WHERE w.WellID = m.MovefromGUID AND w.well WHERE w.WellID = m.Move2GUID
somewhere in the INNER JOIN's so I am experimenting with that right now. Any other suggestions are certainly helpfull.
Some of the questions we need to ask are:
What materails were moved from storage to wells
What materials moved from wells to storage
What crews moved the materials
Total quantity of each material moved by day by week, etc.
So yeah there is a lot that needs to be gathered and displayed which is why I'm beginning to question my initial database design and wondering if I need to change it dramatically now to save more headaces later.
Years ago with Access 2 and then Access 2000 I finally remember doing something like what I wanted. Using the hlp for Access 2007 is nigh on useless - it is more oriented toward promoting its features than offerring help. I found an old copy of Office 2000 and installed the help and went into it for Access and what I THINK I need is some form of UNION query. That should allow me to keep the seperate tables for Wells and Locations and still be able to pull out either data in wither field. If I run into problems I'll upload a sample of the code later.
Larry
modified on Friday, June 25, 2010 10:07 PM
|
|
|
|
|
At my company we use an instrument which connects to a laptop through ATEN USB to Serial Bridge. What I'm trying to figure out how to do is loop through the COM ports and determine which one the bridge is connected to (similar to the windows device manager that will show the devices name with which COM port it is connected to in parentheses). Anyone have any guidance on how to do this through VB.NET? Even C# code would work as I can probably figure out how to port it. Thanks in advanced.
|
|
|
|
|
There is no standard for this; RS232C defines connectors, pin assignments, voltage levels, bit patterns, but does not describe the content of the data being transmitted. So the best you could do, I guess, is this:
1. connect your peripheral to a known port, open its SerialPort, keep HandShake none;
2. now check the behavior of your periphera;
2a. look for the state of control lines (CDHolding, CtsHolding, DsrHolding);
2b. disconnect and look again;
2c. hopefully there is a difference.
3. optional: check the response on some command; use the device manual!
3a. send a harmless string (best something that would mean "identify yourself"
3b. and watch what the normal reply is.
4. now create code that enumerates the ports, one by one, looking for one (or more) that match the above findings.
|
|
|
|
|
The actual instrument that is connect through the bridge I already know how to communicate with. However, I want to be able to tell when the bridge is plug in to the computer independent of when the instrument is connect to bridge. If I plug the USB-Serial adapter into the computer and look under the Windows Device Manager, under Ports (COM & LPT) is will now list "ATEN USB to Serial Bridge (COM2)", if I unplug it, it will be removed from this menu. So windows definitely knows when the USB-Serial adapter is attached to the computer and which COM port it is plug into. There is no windows service, or something similar , I can poll since I know the name that appears in the window device manager? I was hoping there was something in the System.Management namespace that could do it.
|
|
|
|
|
OK, so I misunderstood.
On USB Windows discovers device insertion/removal by "plugNplay" technology. I don't know the way to interface to that system. I have been looking into the WMI classes such as Win32_SerialPort to no avail.
I do know, at least for some manufacturers, you can make sure the USB-to-RS232C cable always gets the same name ("COM2" in your example), independent of the exact USB port used; I often have had the opportunity to even choose a completely different name, say "MySerial". Not sure on which Windows version(s) this is possible.
If that works for your Windows+cable combination, then by all means choose a unique name, then enumerate all serial ports using SerialPort.GetPortNames (or just try SerialPort.Open).
|
|
|
|
|
Can any one help me how to pass values from one window form to another by clicking on one record in the datagrid placed on one of the window form and passes values to another form and displays the whole record in the text boxes of the form.
Regards
|
|
|
|
|
I think the best way to explain this would be an example. Say you have a collection of people in a DataGrid and when the user selects a particular person, their details should show up in the second form textboxes. Lets use this class :
Public Class Person
Private strName As String
Private intAge As Integer
Public Sub New(ByVal personName As String, ByVal personAge As Integer)
strName = personName
intAge = personAge
End Sub
Public Property Age() As Integer
Get
Return intAge
End Get
Set(ByVal value As Integer)
intAge = value
End Set
End Property
Public Property Name() As String
Get
Return strName
End Get
Set(ByVal value As String)
strName = value
End Set
End Property
Public Shared Function GetPeople() As List(Of Person)
Dim lstPeople As New List(Of Person)
With lstPeople
.Add(New Person("Shantell", 23))
.Add(New Person("Bill", 45))
.Add(New Person("Keith", 36))
.Add(New Person("Jason", 73))
.Add(New Person("Sean", 45))
.Add(New Person("Chris", 90))
.Add(New Person("Peter", 15))
.Add(New Person("Jeremy", 22))
.Add(New Person("Kevin", 67))
End With
Return lstPeople
End Function
End Class
Then in your main form you declare a local instance of your second form at the class level and instantiate it in your main form load event . The code for the first form looks like this:
Public Class Form1
Private People As List(Of Person) = Person.GetPeople 'collection of business objects
Private frm2 As Form2 'declare form2 at class level
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
frm2 = New Form2(People(0)) 'instantiate local form2
frm2.Show() 'make sure is visible
DataGridView1.DataSource = People 'bind DataGridView to collection
End Sub
Private Sub DataGridView1_RowEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowEnter
If People.Count > 0 Then
frm2.RefreshPerson(People(e.RowIndex)) 'call function in form2 to set new selected object
End If
End Sub
End Class
In your second form you declare a local variable of type person and you include a public function to receive any changes to the selected person in form 1.:
Public Class Form2
Private CurrentPerson As Person
Public Sub New(ByVal yourPerson As Person)
InitializeComponent()
CurrentPerson = yourPerson
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
UpdateUI()
End Sub
Public Sub RefreshPerson(ByVal yourPerson As Person)
CurrentPerson = yourPerson
UpdateUI()
End Sub
Private Sub UpdateUI()
txtAge.Text = CurrentPerson.Age
txtName.Text = CurrentPerson.Name
End Sub
End Class
This approach should get you up and running, although personally I would rather encapsulate this in one form, as they are too inter linked in my opinion.Hope this helps.
Happy Codong
|
|
|
|
|
Hi
How can i create a setup file that installs required file if required by the operating system like .Net framework 3.0, 3.5 and like sql 2000 or 2005 .ldf and .mdf files.
I donot understan where to place these files in the setup so that it installs automatically on the specified location and i donot have to copy these files and install them on the specified location.
Please help
regards
|
|
|
|
|
Hi again,
I assume you have created a Windows Forms application, so to include your pre-requisites such as .Net Framework 3.0 or 3.5 you need to go to solution explorer, right click on your project and select Properties. On the tab page that comes up select the Publish tab, then click the Prerequisites button. A dialog box should come up allowing you to select which Prerequisites you want included in the setup. If you want to include the Prerequisites in the same Setup folder as the application setup then tick the radio button Download prerequisites from same location as my application and click OK. This will ensure your selected prerequisites are included with your application setup program. To install extra files such as text or database files etc in a specific location on the target machine, you need to right click your SETUP project in solution explorer and select File System. Under the tab page that comes up highlight File System on Target Machine , and in there you can create folders as necessary, and include whatever you like in those folders, and these will be created on all mechines on which your application is installed.
One thing that you need to think about, and that is Windows permissions, especially on Vista and Windows 7 machines, as the user who installs the application will probably not have full admin privileges therefore it is always better to use Windows default folders where possible.
Hope this helps
Happy Coding
|
|
|
|
|
Hi
Please help, i want when any one clicks on my application icon first loads the splash screen then the login form and then the application. For this i want to use the timer control on the splash screen when the the condition is true that is 5 seconds then load the login form.
regards
|
|
|
|
|
Hi,
I'm writing a steganography app in vb.net, which hides one bmp inside another within the least significant bits.
I want to be able to hide/show the least significant bits to reveal the hidden image. At present this is done via 8 checkboxes. The current code works somewhat but when showing the bits to reveal the second image, the image is visible but is black with no colour information.
Heres an example of my current code to show/hide the least significant bits
Dim b1, b2, b3, b4, b5, b6, b7, b8 As Integer
Dim MaskByte As Integer
If cb1.Checked = True Then
B1 = 1
End If
If cb2.Checked = True Then
B2 = 2
End If
If cb3.Checked = True Then
B3 = 4
End If
If cb4.Checked = True Then
B4 = 8
End If
If cb5.Checked = True Then
B5 = 16
End If
If cb6.Checked = True Then
B6 = 32
End If
If cb7.Checked = True Then
B7 = 64
End If
If cb8.Checked = True Then
B8 = 128
End If
MaskByte = b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8
For x = 0 To Image.Length - 1
If x <= 54 Then
MaskedImage(x) = Image(x)
Else
MaskedImage(x) = Image(x) And MaskByte
End If
Next
CreateBitmap(MaskedImage)
Image() is the opened bitmap converted to a byte array.
It's strange as i can see the outline of the second image, but it contains no colour.
Any help would be much appreciated. Thank You
|
|
|
|
|
Hi,
I'm not sure what you are doing here. Some comments:
1.
you don't need all the b1, b2, b3, b4, b5, b6, b7, b8; you could add to MaskByte right away.
2.
your image may have 4 components: RGB+alpha, so you may be manipulating the alpha/transparency too.
3.
what is the magic about byte value 54?
4.
all your code does is bringing every byte closer to zero; and all-zero is black.
5.
you probably want something like:
For x = 0 To Image.Length - 1
If (x MOD 4) = 0 Then
Image1(x)=Image(x)
Image2(x)=Image(x)
Else
Image1(x)= Image(x) AND MaskByte
Image2(x)= Image(x)-Image1(x)
End If
Next
which still brings things closer to black, but at least it is separating two images.
|
|
|
|
|
Thanks for the reply
The aim of the checkboxes was to allow the user to see the image gradualy transform into the hidden one.
Byte 54 is the start of the bitmap data. Before this, the bitmap contains data such as the file size, resolution, number of colors utilised etc..
I've tried the suggestion but still can't get it to work. The hidden covert image has been encoded into the 4 least significant bits of the original image, so i just need to apply a filter to show the hidden image. I'm just unsure how to acheive this.
I did find some code in matlab that works to extract the hidden image, but i don't now how to convert it to vb.net code.
n = number of bits to utilise i.e. 4 LSB
Stego = Bitmap Image that contains the hidden image
Extracted = Hidden image extracted fromt he Stego bitmap
<br />
Extracted = uint8(bitand(255, bitshift(Stego, 8 - n)));<br />
Thanks for your help
|
|
|
|
|
OK, now I see what you are after, I think.
The one image basically consists of image1(x) = image(x) AND &HF0 i.e. the high nibble of every byte (except for the bitmap header, and possibly the alpha channel).
The other image is stored in the lower nibble, but needs a multiplication factor, so that would be
image2(x) = 16*(image(x) AND &H0F) .
[EDIT]BTW: multiplying by 16 is the same as shifting left by 4, as in y << 4 [/EDIT]
And you can morph from one to the other by having a mix of the two; say alpha is a number between 0 and MAX; then you could do image3(x) = ((MAX-alpha)*image1(x) + alpha*image2(x))/MAX . Obviously when alpha is zero this yields image1, and when alpha equals MAX it yields image2. Pick MAX = 16 or 256 or something like that.
|
|
|
|
|
Thanks for your help ! , thats exactly what i'm after. I can now sucessfully extract the hidden image.
Now finished the program, Thanks for the help Luc Pattyn
modified on Friday, July 2, 2010 7:28 PM
|
|
|
|
|
I am trying to create an application that can connect to a database on a remote server. If anyone knows how to achieve this or has any good reading material please could you let me know?
Any help is much appreciated.
McGann
|
|
|
|
|
Mc--Gann wrote: remote server
By this I assume you mean 'Not on the same Local Area Network'
Also, what type of database are you trying to connect to?
Steve Jowett
-------------------------
Real programmers don't use PL/1. PL/1 is for insecure momma's boys who can't choose between COBOL and Fortran.
|
|
|
|
|
Correct its over the web. It's a MSSQL database
ASP all the way
|
|
|
|
|
You can connect to SQL over internet. Check out ConnectionStrings.com for connection string.
|
|
|
|
|
thanks for the help
ASP all the way
|
|
|
|
|
You should be aware of firewall inparticular the UDP ports. MS SQL Server uses port 1440 as standard but is othen changed. Assuming the port is 1440 then in your connection string you will need to specify the port along with the server ip address, for example :
Data Source=123.123.123.123:1440;Initial Catalog=MyDatabase;User ID=MyUserId;Password=MyPassword
Steve Jowett
-------------------------
Real programmers don't use PL/1. PL/1 is for insecure momma's boys who can't choose between COBOL and Fortran.
|
|
|
|
|
Who in their right mind exposes a SQL Server directly to the Internet?? That's insane!
|
|
|
|
|
Fasthosts do and that seems quite secure to be honest, I can access it using management studio from my PC easily which makes for simple maintenance.
Phil
Software Developer
http://www.yorkshirehumberit.co.uk
|
|
|
|
|
I have developed a software using visual basic. It is designed to run in a network. I deployed the software on the application server and try running it on the same computer and it worked fine. I tried accessing it on my development pc and it worked fine as well, but when i tried accessing it to local computers/ clients, it gives me an assertion error and i don't know what to do with it.
I have three (3) assertion errors.
Debug Assertion Failed!
File : dbgdel.cpp
line 47
Expression: _BLOCK_TYPE_IS_VALID(phead->nBlockUse)
Debug Assertion Failed!
File: dbgheap.c
line: 011
Expression: crtIsValidHeappointer(pUserData)
Debug Assertion Failed!
File: dbgheap.c
line: 1017
Expression: _BLOCK_TYPE_IS_VALID(phead->nBlockUse)
I have until Friday to make my software work before it goes live, so i am in urgent need of help..
Any response will be deeply appreciated. Thank you
|
|
|
|
|
"dbgdel.cpp", "dbgheap.c", those are C files, not Visual Basic. Can you copy/paste the part of the source that's throwing the assertion?
I are Troll
|
|
|
|
|