|
so wht,s the problem simply just apply the condition on + button and - button. +button.click=dgv1, dgv2 else false
hope u understand
byeeeeeeee
lucky
|
|
|
|
|
Nope I dont understand -
I dont have any button conditions because of this below-
datarelation = New DataRelation("Line View", dc1, dc3)<br />
MyDataSet.Relations.Add(datarelation)
creates the + - condition on the grid. When the app is running when I click on a record it expands and you see a link that says "Line View" once I clink that link it opens a different table - I dont want it to do that I want it to show the nested table with just one click on the row
Is there away to raise a condition to control the + and - that comes with datarelation? Oh Yea I'm not using two datagrids - One datagrid with two datasets. Well One dataset two tables.
-- modified at 8:28 Friday 7th September, 2007
-- modified at 9:30 Friday 7th September, 2007
Thank You
|
|
|
|
|
Description
I am making a Paint Brush Like application in Vb 2005. My intention is to join the points by draw line method as the mouse moves. I am facing some issues as the “AutoRedraw” is not available for PictureBox.
To overcome this shortcoming i started coping the screen as image using "CopyFromScreen”, ad loding that image in the PictureBox, as the lines are drawn. My issues with this solution are :
- The process of saving and loading the Image in picture box had made the application very slow, which intern are making me loose some points.
- My intention is to use a Picture box (Drawing area for the users), bigger then the screen. It is becoming very difficult to exactly calculate at which portion of the picture box i am taking a snap of and where to put it in the Image of picture box.
What all had tried
- I moved the "Saving from screen and loading back in the PictureBox " codes to a timer: Codes do work but the points which i am getting while the timer calls the codes to save the image are missed
- I tried putting the codes to save image in a thread... not able to succeed
Can any one please help me with it I am in urgent need of this
Platform
VB 2005 /Express IDE / Sharp Developer
Nishkarsh
|
|
|
|
|
Hi,
two comments:
1.
a PictureBox is not the right Control for this; its purpose is to show an existing Image,
no more, no less. Yours is not an Image, it is a painting that keeps evolving. So
I would suggest you take a simple Panel.
2.
The normal draw approach is to:
- have some data structures that represent the entire content of your drawing/painting;
- use keyboard/mouse events to modify these data structures;
- have the Paint handler "execute" the data structures, i.e. do the actual Graphics
operations.
As a result, you have:
- data structures ready for saving/restoring your structured document to /from file
- a visible result that gets redrawn automatically whenever it needs to (e.g. because
you resize the Form, uncover it, etc).
- the possibility to resize your drawing/painting based on its high-level representation
(such as font size), rather than pixel-based.
Now for real painting, the above may be rather difficult; if so, you could use a Bitmap,
create a Graphics for it once (with Graphics.FromImage; keep it in a class member),
and paint into that Graphics from your keyboard/mouse event handlers, then Invalidate()
your Panel. In the Panel's Paint handler simply DrawImage() the Bitmap.
But don't first paint on the screen, then try to capture the screen. That is inefficient
at best.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi
Luc Pattyn
thanks for the info...
I will like to let my problem in more detail...
I have to use a tablet attached to the PC which acts as a input device for user
Was successfully able to do all what i told in my question in Vb6
Now when i migrated the code to Vb 2005 I was Not able to do it properly...
Issue is, the tablet sends packets as the user user writes on it... The tablet is of A4 size and the user can write on whole page
If i Use a data structure to store all points and then draw lines between them then one thing the data structure becomes too big and in low config system there is a threat of crashing or system becomes slow
other aspect is that a user will like to see what he writes in a similar size as what e is writing inso i need to make the picture box big which scrolls on the window...
As you suggested, if I use a panel then can i do all the above??
|
|
|
|
|
Hi,
1.
yes I would use a Panel for this.
2.
I would also try and avoid scrolling.
What is the resolution of the tablet (how many points can it discern horizontally and
vertically) ? if that is less than there are pixels on the screen, I would do a one-on-one;
if the tablet resolution is quite different, I would use some scaling so it still fits
the (height of the) screen.
3.
Assuming a lot of data is coming in, I would use the bitmap approach: allocate a bitmap
of the right size, get a Graphics for it; then accept tablet input and paint into the
bitmap using that Graphics.
4.
New suggestion: don't Invalidate() everytime you modify the bitmap, just set a boolean flag.
Then install a Windows.Forms.Timer that ticks say once every 100 or 200 msec; in its
tick handler, if the flag is set, clear the flag and Invalidate the Panel.
As a result you can accept data at full speed, and your screen would be refreshed every
100 or 200 msec (rather than every time the bitmap changes).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
All of my applications have migrated to VB 2005. They all start from Sub Main in a module.
Today I decided to create a new one and set "enable application framework" to true so that I can explore its new features.
The program has been run many times as I add new components. There have been no apparent problems.
I added code that creates a delegate to display the program's name and a date/time string as Form1's text.
It is invoked once a second by a thread spauned by my "Clock" class that runs on a background thread.
I encountered this error when it ran.
Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
How does one create a handle for Form1?
Why wasn't it created automatically when the application started?
Thanks
RCarey
RCarey
|
|
|
|
|
RJGCarey wrote: How does one create a handle for Form1?
You don't. It's automatically created.
The problem is caused by your code not waiting long enough for the window to be completely created. Basically, you're trying to update the window before it exists.
You can either delay starting your "Clock" class or, in the update code, check the Form's IsHandleCreated property before you try to update the Form.
|
|
|
|
|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dbgS As String
bmpMain = New Bitmap(pbMain.Width, pbMain.Height)
AddHandler pbMain.Paint, AddressOf pbMain_Paint
bmpBars = New Bitmap(pbBars.Width, pbBars.Height)
AddHandler pbBars.Paint, AddressOf pbBars_Paint
instDelFormText = New delFormText(AddressOf FormText)
Shw.SetUp()
'error handling is now available
Try
MySql.Open()
Thread.Sleep(5000)
dbgS = Me.IsHandleCreated
Clock.Start()
Catch ex As Exception
Shw.Err("Form1_Load " & ex.Message)
End Try
End Sub
Put in the sleep. It does sleep.
put in dbgS. It Shows true.
Same error.
Thanks
RCarey
RCarey
|
|
|
|
|
Hi,
putting a Sleep in the main thread won't help, it just stops the world for a while,
nothing happens any more, no handles would get created in the mean time.
Where is it failing? Look at the line numbers in the Exception, and watch the line
numbers of your source code.(See my tips!)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Here's my code.
This code is in my 15+ other applications and it works all the time.
Form1
Private Sub Form1_Load
instDelFormText = New delFormText(AddressOf FormText)
End Sub
Public instDelFormText As delFormText
Public Delegate Sub delFormText(ByVal inText As String)
Private Sub FormText(ByVal inText As String)
Try
Me.Text = inText
Catch ex As Exception
Shw.Err("frmMain.WriteFormText " & ex.Message)
End Try
End Sub
Module Clock
Private Sub DoNewSecond()
Try
Form1.Invoke(Form1.instDelFormText, CObj("BarHunter 2005" & Space (100) & Now.ToString))
Catch ex As Exception
Shw.Err("Clock.DoNewSecond " & ex.Message)
End Try
End Sub
The failure occurs on Form1.Invoke etc
Thanks
RCarey
RCarey
|
|
|
|
|
Hi,
there is less code now than there was before in Form1_Load. The Form1 constructor is missing,
the Clock stuff is not complete.
Where do you start the clock? I would do it as the last thing in Form1_Load
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
My last post was just an abstract. The post prior to that has all the code. Starting the clock is the last thing in Form_Load.
In my other applications the form is created in Sub Main.
Here is the code.
Public Sub Main()
frmMain = New Form1 'new form
frmMain.Show() 'show it
Shw = New clsShow 'new class
Shw.SetUp() 'set up the graphics
cName = SystemInformation.ComputerName() 'get computer name
handleEndWorking = Now.ToString("yyyyMMdd") 'set the handleendworking
mySql = New clsMySql 'connect to the database
hntB = New BarHunter.clsBase 'new hunting base class
hntB.setUp = New BarHunter.clsSetUp 'new set up class
hntB.setUp.DoIt() 'do the job
hntB.setUp = Nothing 'dispose
Application.Run() 'run
End Sub
Now I just discovered that when I run my Show Procedures from another thread it doesn't work. It modifies a bitmap linked to a picture box on the form and then invalidates that picturebox.
Enable application framework sure creates a different critter.
Thanks
RCarey
RCarey
|
|
|
|
|
Hi
Can anybody tell me how can I call a procidure requiring arguments with a new thread. e.g. a code snippet like this.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim trShow As New Thread(AddressOf ShowMessage) 'error
End Sub
Sub ShowMessage(ByVal message As String)
MsgBox(message)
End Sub
Thanks for replying for a hobbyist progarmmer.
reman
|
|
|
|
|
Which version of VB.NET??
|
|
|
|
|
Create a new instance of a class passing parameters.
Create a new thread pointed at the sub in that class that does the work.
Name and start the thread. If you want you can wait till the thread finishes(Join) and then dispose of the instance of the class.
Here is a code snippet.
SQL.B.setDay = New SQL.clsSetUpAnyDay(Now.Date) 'new class
thdWorker = New Thread(AddressOf SQL.B.setDay.DoIt)'new thread
thdWorker.Name = "setDay" 'name it
thdWorker.Start() 'start
thdWorker.Join 'wait till it finishes
SQL.B.setDay = Nothing 'dispose
Hope that helps.
RCarey
RCarey
|
|
|
|
|
I have a Crystal report and a CrystalReportviewer and i want to put a button to open pagesetup for this report.In the CrystalReportViewer toolbar i see only a print , zoom and some other buttons but no Pagesetup.
Any idea
Thanks.
|
|
|
|
|
hey guy
if u click on print button at cr report it will automatically display the pagesetup or print option
if u want to seprate add a button then write code
crrptview.printreport=true
hope u understand
lucky
|
|
|
|
|
Hi,
I'm trying for days now to figure out how to implement "Volume Shadow Copy Service" (VSS) under vb.net.
The goal is to get a tiny application the runs at XP, Vista and 2003 to make backups of files in use (locked).
I read almost the complete Internet and Google-Cache but didn't find any helpful startup-point. The "Volume Shadow Copy Service SDK 7.2" is C++ only, what's definitly not my language
Documentation can be found at: http://msdn2.microsoft.com/en-us/library/aa384961.aspx[]
Anybody out there that can give me a hint
Regards,
wtfia2k
|
|
|
|
|
Interesting.
Well, the documentation was written for a target audience of C++ developers, but that hardly makes the SDK "C++ only".
Though I can't find any VB.NET, or any other language, code samples, it's possible to use the VSS from VB.NET. Start by adding a COM Reference, in your VB.NET project, to the Volume Shadow Copy Service, then open the Object Browser and look through the Interop.VSS item listed in the browser.
You are venturing into uncharted waters here. You probably will not find any articles, samples, or knowledgable help on using VSS from your app.
|
|
|
|
|
Dave Kreskowiak wrote: Interesting.
glad to here
Dave Kreskowiak wrote: Though I can't find any VB.NET, or any other language, code samples, it's possible to use the VSS from VB.NET. Start by adding a COM Reference, in your VB.NET project, to the Volume Shadow Copy Service, then open the Object Browser and look through the Interop.VSS item listed in the browser.
that's exactly what I did - so far so good.
Thanks for acknowledging me.
Dave Kreskowiak wrote: You are venturing into uncharted waters here. You probably will not find any articles, samples, or knowledgable help on using VSS from your app
I feared that unfortunately in such a way.
Regards,
wtfia2k
|
|
|
|
|
Thanks again to Dave Kreskowiak who confirmed my idea to use the com-object "Volume Shadow Copy Service 1.0 Type Library".
After fooling around a bit with it I'm that far, that I really make Shadow Copies
Here is the code how I've done it (in a quick and dirty manner, of course )
Dim vshadow As New VSS.VSSCoordinator<br />
Dim snapshotSetID As System.Guid<br />
Dim _snapshotID As System.Guid<br />
<br />
vshadow.StartSnapshotSet(snapshotSetID)<br />
vshadow.AddToSnapshotSet(root, System.Guid.Empty, _snapshotID)<br />
<br />
Dim vssAsync As VSS.IVssAsync = Nothing<br />
Dim callback As Object = Nothing<br />
<br />
Debug.Write("starting shadow copy .")<br />
vshadow.DoSnapshotSet(callback, vssAsync)<br />
While True<br />
Dim hr As Long<br />
vssAsync.QueryStatus(hr, 0)<br />
Debug.Write(".")<br />
If DirectCast(hr, IVssAsyncQueryStatus) = IVssAsyncQueryStatus.VSS_S_ASYNC_FINISHED Then<br />
Exit While<br />
End If<br />
Thread.Sleep(1000)<br />
End While<br />
Debug.Write(" done!")<br />
Debug.WriteLine("")<br />
<br />
Debug.WriteLine("examine snapshot")<br />
Dim snapshotProps As VSS._VSS_SNAPSHOT_PROP = Nothing<br />
vshadow.GetSnapshotProperties(_snapshotID, snapshotProps)<br />
<br />
Dim _snapshotDeviceName As String = snapshotProps.m_pwszSnapshotDeviceObject<br />
Debug.WriteLine("Shadow copy device name: " & _snapshotDeviceName)
So far - so good! But how to access the shadow copy to extract files out of it?
Trying someting like this:
Dim ShadowedRoot As String = Nothing<br />
vshadow.ExposeSnapshot(_snapshotID, Nothing, 1048576, "C:\ShdwOfC", ShadowedRoot)<br />
'vshadow.ExposeSnapshot(_snapshotID, Nothing, _VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY, "c:\ShdwOfC", ShadowedRoot)<br />
Debug.WriteLine("ShadowedRoot: " & ShadowedRoot)
crashes with an NotImplementedException.
What the he.. !!! Does this really mean, it's not implemented in the com yet, or am I doing something completely wrong? (a lot of wood, but now trees ...)
Regards,
wtfia2k
|
|
|
|
|
Well, either the COM interface hasn't been impemented or the parameters are wrong (which it doesn't look like they are), or certain functionality hasn't been fully implemented depending on the values of certain parameters.
I would recommend trying to expose the snapshot as a share on the server to see if that works. If it also fails, then I would have to believe that ExposeSnapshot hasn't been implemented through COM yet.
|
|
|
|
|
I have some DataGridViewComboBoxColumn s in my datagridview. I have all of the code working correctly but I would like to find a way to have the CellValueChanged event fire when the new value is selected in the comboboxcolumn and not after a value is selected AND I click outside of that cell to commit it.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
The Cell value won't change until the cell loses focus. Until then, you're still editing it.
The Cell's value doesn't pickup the value of the ComboBox until focus is lost. This is when the SetValue method of the DataGridViewComboBoxCell is finally called, which sets the value of the DataGridViewCell, which fires the CellValueChanged event. The DataGridViewCombBoxCell doesn't expose any events itself, so I don't know how you're going to know when the ComboBox value changes.
|
|
|
|
|