pankaj.garg 0 Junior Poster in Training

Dear All,

I am developing a application where I have 1 parent from (windowstate of Parent from is set to Maximized) and 2 child forms. In my Parent form I have a menustrip with following code to activate child -

Public Class FormParent
    Public NewMDIChildForm1 As New Form1()
    Public NewMDIChildForm2 As New Form2()

    Private Sub AddChlid1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddChild1ToolStripMenuItem.Click

            NewMDIChildForm1.MdiParent = Me
            NewMDIChildForm1.WindowState = FormWindowState.Maximized
            NewMDIChildForm1.Show()
    End Sub

Private Sub AddChlid2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddChlid2ToolStripMenuItem.Click

            NewMDIChildForm2.MdiParent = Me
            NewMDIChildForm2.WindowState = FormWindowState.Maximized
            NewMDIChildForm2.Show()
    End Sub
End Class

I have buttons on each child form with

me.hide

now when I do following steps

Open Child Form1 - Open Child Form2 - Hide Child Form2 - Hide Child Form1 - Open Child Form1

my Child form1 doesnot appears in Maximized state

Please Help.

Regards,

Pankaj

pankaj.garg 0 Junior Poster in Training

Thanks urtrivedi and BitBlt for the responses.

I will go for single table-1.

Thanks & Regards,

Pankaj

pankaj.garg 0 Junior Poster in Training

Thanks BitBlt for the reply.

I will have to query the Table-1 for whole year. I might be asked to retrieve data from Table-1 for any specified process.

My apprehension is - if my Table-1 becomes too large, will it become difficult to query data from Table-1 ?

Thanks

pankaj.garg 0 Junior Poster in Training

Dear All,

I need your suggestion in developing a Database - I will use MYSQL as database. My database will have below specifications -

- 1 table "Table-1" with 2 columns - DateTime and Integer Value
- 1 table"Table-2" with 5 Columns - columns having process details (i am doing some testing and each test performed is called as process)
- for every process "Table-1" will have 3500 entries and "Table-2" will have only 1 entry
- I have 5-10 process per day
- I have to maintain data for entire Year.

Now please suggest which of the following should I do ?
1. Add a column (to identify the related process) and Keep adding data to my Table-1 for all processes. This will make my Table-1 very large
2. Make a separate Table-1 for every process. This will result in lots of tables
3. I make a Table-1 every month and keep track of process dates in my Table-2

Please let me know if any of above is good solution or should I have a different approach?

Thanks in advance

Pankaj

pankaj.garg 0 Junior Poster in Training

I have found an workaround -

Use a "Panel" on form and set form AutoSrcoll property to true. The "Panel" control seems to have no size limitations.

Pankaj

pankaj.garg 0 Junior Poster in Training

Dear Begginnerdev,

There seems to be a limitation of the screen size which can be set. I cannot drag the size handle beyond a limit and same with the size properties.

I donot want to do it dynamically at run time as I have lots of controls and pictures on form and doing it dynamically will make it messy.

Pankaj

pankaj.garg 0 Junior Poster in Training

Dear Begginnerdev,

Thanks for the replies, but soory I did not make my question clear.

I want to increase the size during design time, so that i can place my controls accordingly.

Pankaj

pankaj.garg 0 Junior Poster in Training

Dear All,

Screen Size of my deployment screen is larger than my development screen.

If i try to set my form size larger than my development screen size, IDE doesnot accepts this.

Please let me know How can I use a form larger than my development screen Size?

Pankaj

pankaj.garg 0 Junior Poster in Training

Dear GeekByChoiCe,

This did the trick :)

Thanks alot for the help.

pankaj.garg 0 Junior Poster in Training

I got the problem. I had added a simple message box in the sub, and as soon as i would press "ok" on message box, the testbox again gets the focus and i see the message box again.

So i have now understood the problem, but have no Idea how should I call a form without returning focus to my textbox.

Actually I want to show a NumericPad when the textbox gets focus and hide it after numbers have been entered, but again the focus shifts to textbox and i get numeric Pad. This gets into infinite loop.

Please Help.

Pankaj

pankaj.garg 0 Junior Poster in Training

Dear GeekByChoiCe,

Thanks for the response. At outset it seemed the perfect solution, but when i went on to implement this I am having trouble.

Anything that I write in Textbox_Focused sub, gets into infinite loop and am unable to proceed.

I have been trying to figure this out for the whole day but have not succeeded. I have just moved from VB6 to VB net so might sound naive, your further help is highly solicited.

Pankaj

pankaj.garg 0 Junior Poster in Training

Hi,

I am developing a VB net application with lots of TextBox. I need to call a module everytime any of the textbox gets focus. I dont want to write code in every textbox gotfocus event, but a generic code which will call the module everytime any textbox gets focus.

Please help.

Pankaj

pankaj.garg 0 Junior Poster in Training

Dear All,

I am working on CE5 device and developing my application on .net Compact Framework 2.
While using threads I am facing a strange problem -

My thread terminates unexpectedly when I call a function from it which does a serial communication.

Any suggestions why this might be happening? In general what are the major conditions for a thread to get terminated??

My application in brief -

I am calling my thread from main form -

stopreadingserial = False
SerialComThread = New Thread(AddressOf CommunicationClass.SerialCommunication)
SerialComThread.Start()

My thread is defined in a communication class

Public Shared Sub SerialCommunication()

Do While (stopreadingserial = False)
BoolRet1 = CommunicationClass.GetValuesSerial
Thread.Sleep(300)

Loop

End Sub

The GetValuesSerial function calls the function which does the actual communication with serial port

Public Shared Function GetValuesSerial() As Boolean
For localCount1 As Integer = 1 To 8
BoolRet1 = CommunicationClass.TempControllerRead(localCount1 + 10, localCount1, 1)
Sleep(50)
BoolRet1 = CommunicationClass.TempControllerRead(localCount1 + 18, localCount1, 2)
Next
GetValuesSerial = True
End Function

Please help !!

Pankaj Garg

pankaj.garg 0 Junior Poster in Training

well, first of all understand that text file will be used as a file which contains information if user has activated the software.
u will need to access the text file from your VB program to check if software is activated, so that the form asking for key doesnot reappear.

1. initially write "false" in your text file
2. when user will start the program, program will look in text file, if its false it will show form which asks for activation key
3. if the key entered is correct, replace "false" with "true" in the text file and show the required form
4. next time user will start the program, the program will again look into text file and will find "true", so it should not ask for activation key.

so first of all you need to find a way to read and write into a text file from VB...google it and u'll find that easily..

Pankaj

pankaj.garg 0 Junior Poster in Training

hello nv136,

Based on my understanding you are trying to do following -
create an activation window for a software, and once activated, never show the message again...


if this is correct, then a simple solution can be -

1.create a text file which will store a value (could be "True", "False", "1", "0" etc. and when your program starts, the program checks the value in the text file
2. Initially the value in the file should be "False" or "0" and once the user enters a correct serial number the value in file changes to "True" or "1"
3. Every time user starts your program, the program first checks the value in the text file and if value is "False" or "0", it prompts for the activation key. If text file has "True" or "1" , it doesnot ask for key and go to the required page.

now few things -
1. this is a very elementary method and users can change values in the text file easily.
2. you can code the "True" , "False" into something else, that users cannot decode.
3. better you can store these values in "Windows registry" somewhere instead of text file, for which you would need to understand how "windows registry" can be accessed etc.

hope this helps.

Pankaj

pankaj.garg 0 Junior Poster in Training

Hello,

I have just migrated from VB6 to VB.net (VB2008) and have created a small test program for Windows CE device in VB .net

Now my problem is how to install this on Windows CE device !! Google has been not a great help to me ..may be i am searching wrong keywords :(

In VB6 i used Package & Deployment Wizard to make a setup file whats the equivalent for this in VB2008?

Can someone please help me or direct me to a right source !!

Thanks in advance

Pankaj

pankaj.garg 0 Junior Poster in Training

Thanks vb5prgrmr...but that did not help...as i could not pass an name to saved file..and it would always get saved with name "Microsoft Visual Basic", also tried changing application title (app.title) before the print command..but didnt work out..

so finally had to resort to creating PDF...i used following tutorial for PDF class..

http://www.vb6.us/tutorials/visual-basic-tutorial-pdf

might help someone :)

Pankaj

pankaj.garg 0 Junior Poster in Training

Hello,

I am making a program, where cycles of a process are running and i have to save a report every 10th cycle. The report should get saved automatically, without human interference and should be saved in a non-editable format (say PDF, JPG etc).

I have tried a couple of PDF printers, but they require human interface to save a file...

please suggest me an PDF creator (preferably freeware :-) ) to which i can pass file name and saves automatically, or an alternative method.

An help is highly appreciated.

Pankaj

pankaj.garg 0 Junior Poster in Training

Hi vb5prgrmr,

Thanks for all the help...though autoredraw was not a problem since it never got turned off..but the problem was restoring back-colour
Box.Line (0, 0)-(.ScaleWidth, .ScaleHeight), .BackColor, BF
turning it off resolved the problem..

Thanks for all the help...

Pankaj

pankaj.garg 0 Junior Poster in Training

thanks vb5prgrmr...but it didnot help...i am using the following routine to get my picturebox printed..and after printing, the picturebox is still getting cleared..is there another method?

Public Sub PrintPictureBox(Box As PictureBox, _
                        Optional X As Single = 0, _
                        Optional Y As Single = 0)
Dim rv As Long
Dim ar As Boolean

    On Error GoTo Exit_Sub

    With Box
        'Save ReDraw value
        ar = .AutoRedraw

        'Set persistance
        .AutoRedraw = True

        'Wake up printer
        Printer.Print

        'Draw controls to picture box
        rv = SendMessage(.hwnd, WM_PAINT, .hDC, 0)
        rv = SendMessage(.hwnd, WM_PRINT, .hDC, _
            PRF_CHILDREN Or PRF_CLIENT Or PRF_OWNED)

        'Refresh image to picture property
        .Picture = .Image

        'Copy picture to Printer
        Printer.PaintPicture .Picture, X, Y
        Printer.EndDoc

        'Restore backcolor  (Re-load picture if picture was used)
        Box.Line (0, 0)-(.ScaleWidth, .ScaleHeight), .BackColor, BF

        'Restore ReDraw
        .AutoRedraw = ar
    End With

Exit_Sub:
    If Err.Number Then MsgBox Err.Description, vbOKOnly, "Printer Error!"

End Sub
pankaj.garg 0 Junior Poster in Training

Hello Santosh,

What I am telling you may not be the best solution, but since you dont want data report and Crystal (and assuming other costly reporting tools)-

1. Prepare your report on a separate form, design it the way you like...when user previews the report..open this form and populate the test results
2. Print it using - "Me.printform"
3. Do make sure your form size and paper size matches

Again, this may not be the best of practices, but hope this helps :-)

Pankaj

pankaj.garg 0 Junior Poster in Training

Thanks vb5prgrmr for the suggestion...

while i am working on your suggestion, one immediate problem i face is printing this picturebox (containing the chart)!! when i print it the picturebox gets cleared it seems !! please help.

Thanks

Pankaj

pankaj.garg 0 Junior Poster in Training

Hello,

I have multiple problems in an application plotting online data. Below are my problems -

1. MSCharts flickers if my updation time is fast (around 1 sec), I have played around with Repaint, LockWindowUpdate and Visible methods, but no positive results. Is there a better method to stop flicker?

I also tried binding mschart to MS-Access using ADO, but by using that, when mschart gets updated the chart re-size itself, which gives a very bad look to chart

2. I am having around 2000 rows of data at a time on screen, so my vertical gridlines clutter too much, is there a method to show only few grid lines, maybe every 100th or so?

3. I tried hiding the gridlines and then use API lineto and drawtext, but when i try to print the mschart, these does not get printed.. any solution?

at last please let me know which is the best method to plot online data coming at very high rate (around 100 ms)?

any help is highly appreciated

Pankaj

pankaj.garg 0 Junior Poster in Training

Hi Abyan,

I dont have ready examples to provide you, but can give u few pointers on how to go about this project..

1. You are looking for serial communication - Use MSComm Control for that - MScomm would help you to transfer command/data to microcontroller through RS232 port of your PC
2. The voltage level from your RS 232 port on Computer (TTTL logic) might not match that of Micro -controller - you might have to use a converter for that
3. When basic hardware is set up, you would need to send data from your PC to micro-controller - you can get a sample program on URL mentioned below
http://www.rentron.com/sending_data.htm

hope this helps you...
best of luck

Pankaj

pankaj.garg 0 Junior Poster in Training

Hello,

I am using MScharts and want to mark individual datapoints in the chart. I am using following code for adding marker -

with mschart1.plot.seriescollection.item(3)
.SeriesMarker.Auto = False
.DataPoints.Item(-1).Marker.Visible = True
.DataPoints.Item(-1).Marker.Size = 60
.DataPoints.Item(-1).Marker.Style = VtMarkerStyleX

By using above, I am able to mark the entire series, but the problem is I am not able to select a individual datapoint.

The .Item value has to be always -1 (any other value gives an out of bound error)

Please help me to select a specific datapoit in the series on which i can mark.

Thanks & Regards,

Pankaj

pankaj.garg 0 Junior Poster in Training

hi Masterace,

Based on your 2 threads, i understand that solution to your problem could be something like this-

1. create a file to store your last receipt number i.e. "2001" (its last 4 numbers of receipt number u gave TK012001)
2. Every time u want to print a receipt -
a) fetch this number from your file
b) increment this
c) append it with "TK01"
d) restore the incremented number to your file

hope this is what you were looking for...

Pankaj

pankaj.garg 0 Junior Poster in Training

Hi,

i am trying to create a report using VB6...the format of the report is attached as pdf file..the format of report is important for me..
i have my data in Access and finally would like to print report on a word document..

Please let me what should i use to create the report ? so that i start reading tutorials on that..

thanks,

Pankaj

pankaj.garg 0 Junior Poster in Training

Thanks...problem solved..
i was giving wrong arguments for open connections..

regards,

Pankaj

With rs
.Open squery, conn, adOpenStatic, adLockPessimistic
.Edit <--- REMOVE THIS
.Fields("EmpID") = txtEmpID.Text
.Fields("LName") = txtLast.Text
.Fields("FName") = txtFirst.Text
.Fields("MName") = txtMiddle.Text
.Fields("Pos") = txtPos.Text
.Update
End With

pankaj.garg 0 Junior Poster in Training

but wait, .Edit is neither method nor data member of ADODB Recordset.

Hi Arvin2006,

though this is an old post..but i am stuck at same problem as you were that time...".edit" is neither method nor data member of ADODB recordset...so how do i edit my record??

Plz help..

Pankaj

pankaj.garg 0 Junior Poster in Training

yes kinwang2009, i want to transfer the data over internet, from my MSAccess datafile to a client system...

Hi Pankaj,

I am still not clear about your similar communication over Internet. Do you mean to say a chating facilities over Internet/LAN?

Thanks

pankaj.garg 0 Junior Poster in Training

Thanks kinwang2009 for the code..

while i play around with the code and get comfortable with it...can you please suggest me how to go about similar communication over internet ??

Thanks in advance..

Hi Pankaj,

This is kinwang2009 again. I have made some sample code for you.
You can find the attached sample code. You are also welcome to rate my post if it is helpful to you.

Thankx

pankaj.garg 0 Junior Poster in Training

Hi kinwang2009 ,

Thanks for showing your interest in helping me out..i have attached a sample datafile...basically its mostly integer values..and i need to send the data in it over LAN for generating reports....

for second part...by "similar communication over internet" i meant that i want some one sitting in another city should be able to generate reports using this datafile (stored on my local computer) using internet..

Thanks

Pankaj

Hi Pankaj,
Ofcourse i am newbie to this site i have developed some programs that is shareable over LAN using MSAccess as database. Can you upload yous MSAccess database and make everyone clear that what type of Data you want to transfer from your computer.

What it mean by similar communication over internet? Do you mean to say simple Chat Program over LAN or Internet?

Thanx

pankaj.garg 0 Junior Poster in Training

Thanks sidnei and vb5prgrmr,

i understood your point of choosing database...but since i have developed the application using MSAccess...i dont want to change it for this application...
i'll be creating a separate datafile each day...so mydata file wont become too heavy :)

now request you to tell me how to transfer data over internet..when i have a datafile of Access..would it be possible to use a ASP solution to do the data transfer?? how??

all i need to do is send the data from the datafile form my main computer to other computers..and my VB program running on my main computer can have no role in this..

Please help..

pankaj.garg 0 Junior Poster in Training

Hi,

i am developing a program which will store live data (data read from some device every second) into MSAccess database...now i want that data to be available over LAN... i.e. my main computer will be connected to device and i want other computers to read data from the database in main comp...

and as next step, i want similar communication over internet...

Please help me to get a start....Please suggest me readings/tutorials that i need need to go through for this type of communication..

Thanks

Pankaj

pankaj.garg 0 Junior Poster in Training

Thanks 'vb5prgrmr' and 'ggeu' for helping me to understand this...

Thanks QVeen72 for suggestion...but its already been suggested by 'ggeu' and 'vb5prgrmr'

Thanks

pankaj.garg 0 Junior Poster in Training

thanks vb5prgrmr for the code...
this is what i was looking for...sorry if i was not very clear in my requirements earlier :)
it would be of great help if you could tell me how to use this as array now?
one more thing, i have to use 'mouse events' with the control..so as i understand, the declaration would become something like

dim WithEvents c As Picturebox

please guide me to complete this..

Thanks

pankaj.garg 0 Junior Poster in Training

thanks ggeu for all the effort and help..
your solutions were useful...but i was looking for some like what vb5prgrmr gave...
sorry if i was not clear in my requirements..

Thanks

pankaj.garg 0 Junior Poster in Training

thanks ggeu for reply,

but i want to add picturebox at runtime...and cant have them beforehand on the form...and i am finding it difficult to add picturebox at runtime !!

pankaj.garg 0 Junior Poster in Training

thank you vb5prgrmr,

but the problem seems to remain the same..i think i am doing something very basic wrong !!

to make things simpler for myself..i tried adding a single picturebox at runtime..with following code...

Private Sub Command1_Click()
Dim mimage As PictureBox
Set mimage.Picture = LoadPicture("path\image.jpg")
end sub

but still the result is same..same error !!

Please guide..

pankaj.garg 0 Junior Poster in Training

Hi,

i am trying to create a program where user can add picture to a form at runtime..and store it in a database as well...i am using following code to define array of picturebox and load a picture in it...

Dim mimage() As PictureBox
ReDim mimage(0 To num1) As PictureBox
[B]mimage(num1).Picture = LoadPicture("path\filename.jpg")[/B]

but getting a error on the bold line - "object variable or with block variable not set"

Please help to resolve this...

pankaj.garg 0 Junior Poster in Training

great !!!
thanks sidnei...solved my problem...
your explanation was fine...and so is your english

Thanks..

pankaj.garg 0 Junior Poster in Training

thanks sidnei...

my solution was a work around...your's is exactly what i was looking for..

Thanks

If I understood... this is not a MSComm's doubt, but a concatenate syntax doubt...

Seems to me you want the "9600" - and the others values - to be a value given by the user (in a textbox, for example...)
If this is correct, try to put these values you want in a string variable, then pass THIS new string to the settings properties...

Dim cParametros as String

cParametros = txtVeloc.Text
cParametros = cParametros & "," & txtParidade.Text
cParametros = cParametros & "," & txtNum.Text
cParametros = cParametros & "," & txtParada.Text

mscomm.settings = cParametros

Assumes that the "txtVeloc" is a textbox that contains the baud, "txtParidade" contains parity information, and so on...
If these values are already stored in others variables, you can change the textbox names to your variables names, or

mscomm.settings = YourBaudVariable & "," & YourParityVariable & "," & YourBitsVariable & "," & YourStopBitVariable

Of course you can use this second method with textboxes too, change the variable names to textboxes names in the sequence you want.


Hope this helpfully.
Sidnei

pankaj.garg 0 Junior Poster in Training

thanks sidnei for the information...

let me check it and see how can i use it...though i'll be searching on net on how to give DOS commands using VB6..but if u have a ready reckoner plz let me know...

Thanks

Hi pankaj.garg,
you can use "AT" DOS command to schedule a single application to run on a specified day, once a week, or every day, and call you program to make what you want.

Some like this

> AT time NAME.EXE

For example, if your application is named MYAPP.EXE, and you want to execute them at 2 PM today, you should use

AT 14:00 MYAPP.EXE


Also, you can schedule it to run 1 AM, every day, using also like this

AT 1:00 /EVERY:M,T,W,Th,F,S,Su
or
AT 1:00 /INTERACTIVE /EVERY:M,T,W,Th,F,S,Su


Note: the switch "/INTERACTIVE" should be used if you want the user interact with your application; if not, use only "EVERY" switch, specifying the days of week you want to run you app.

NO TIMER or INFINITE LOOPS are needed in you application, and no need to remain open before do the tasks.


I hope this help you.
And I sugest you visit this link http://support.microsoft.com/?scid=kb;en-us;313565&x=13&y=17 it contains more detailed explains for use this command.


Best regards!
Sidnei

pankaj.garg 0 Junior Poster in Training

Well for somthing that happens only once a day and only after midnight, you could increase the interval to its max, 65535, which is just over a minute...

Good Luck

Thanks...but i would like to refrain from using timer mainly cuz of reason - if i increase the time interval, i'll mixup data of two different dates..

pankaj.garg 0 Junior Poster in Training

what is the database that you are using ?

i m using MS Access...and using DAO to access database..

pankaj.garg 0 Junior Poster in Training

Hi,

i m trying to make a program (VB6) in which i need to do some tasks as soon as the date changes (like creating new database etc.), but dont know how to keep track of date change...searching on this gave me following -

1. Using a timer with 1 sec duration to keep track of date-change - but i suppose its a waste of memory resource
2. using windows task manager to fire a event every midnight - but i dont have a idea how to do this

Please suggest a way out..is there a event trigger for date change?? if not please help me to get clarity on above two solutions or any other method that u might think is a better solution..

Thanks in advance.

pankaj.garg 0 Junior Poster in Training

got my answer...need to use 'api'

Declare Function ConfigurePort Lib "winspool.drv" Alias "ConfigurePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long

explanation
· pName
Points to a null-terminated string that specifies the name of the server on which the specified port exists. If this parameter is NULL, the port is local.

· hWnd
Identifies the parent window of the port-configuration dialog box.

· pPortName
Points to a null-terminated string that specifies the name of the port to be configured.

user get '0' (if cancel is pressed) or '1'(if ok is pressed) as return

Private Declare Function ConfigurePort Lib "winspool.drv" Alias "ConfigurePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long

Private Sub Form_Load()
MsgBox ConfigurePort(vbNullstring, Me.hwnd, "COM2:")
MsgBox ConfigurePort(vbNullstring, Me.hwnd, "LPT1:")
End Sub

Thank you phpbeginners for the help...now i have been able to create the module class using Mscomm reference...

now am stuck with one more thing with Mscomm..need you r help..

we can do mscomm.settings = "9600,n,8,1"....
but if i want something of sort
mscomm.settings = "br,pr,db,sb"

where br,pr,db,sb are values provided by user...as i dont want these values hardcoded...

Thanks in advance.

pankaj.garg 0 Junior Poster in Training

Thank you phpbeginners for the help...now i have been able to create the module class using Mscomm reference...

now am stuck with one more thing with Mscomm..need you r help..

we can do mscomm.settings = "9600,n,8,1" ....
but if i want something of sort
mscomm.settings = "br,pr,db,sb"

where br,pr,db,sb are values provided by user...as i dont want these values hardcoded...

Thanks in advance.

pankaj.garg 0 Junior Poster in Training

Hi,

i have couple of doubts..

1) How do i use MSComm Component in a module...i could gather that i might have to use 'class module' for that..but not able to make that work.

2) if i use a class module..how to pass parameters to a class...as i would like to pass some parameters to Mscomm every-time i call the class module

Thanks in advance.

pankaj.garg 0 Junior Poster in Training

thank you vb5prgrmr..this what i was looking for...

Thanks