vb - I am trying to print other form but this happens: - vb.net

(this is my first post so correct me if I'm doing something wrong.)
Here is a bit of my code:
imp.id.Text = globalvars.mdataset.Tables("table1").Rows(0).Item("id")
imp.date.Text = globalvars.mdataset.Tables("table1").Rows(0).Item("date")
imp.hour.Text = globalvars.mdataset.Tables("table1").Rows(0).Item("hour").ToString
imp.PrintForm1.PrinterSettings.DefaultPageSettings.Margins = New Printing.Margins(10, 10, 10, 10)
imp.Show()
imp.Focus()
imp.PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
imp.PrintForm1.Print()
and what happens is that when it gives me the preview the page is empty... but the weird thing is that when i place a msgbox just before the printing action, the preview goes right and shows me what i want to print....
any tips?
EDIT: imp is the form where the printform is

Try to add this ..
....
Application.DoEvents
imp.PrintForm1.Print()

Related

Janus GridEX - C# How to show multi-line header using columnsets at runtime?

I have already tried:
How to wrap header caption in Janus GridEx
and
https://www.c-sharpcorner.com/forums/table-column-set
and looked through Janus documentation at http://codelibraries.blogspot.com/search/label/Janus%20GridEX.
I have a business requirement to show wrapped column header. For example, if column header is:
This is column header
need to show
This is column
header
As it is right now (before I tried implementing code for this requirement), code looked like:
dgMulti.SetDataBinding(bulkTable, "")
dgMulti.RetrieveStructure()
Dim column As Janus.Windows.GridEX.GridEXColumn
For Each column In dgMulti.RootTable.Columns
column.Width = 150
Next
where bulkTable is a System.Data.DataTable object.
After visiting above links, I tried suggestions and used ColumnSets as shown below and added after above code:
Dim CSET As New Janus.Windows.GridEX.GridEXColumnSet()
CSET.Caption = "YourCaption"
CSET.HeaderAlignment = Janus.Windows.GridEX.TextAlignment.Center
CSET.ColumnCount = 2
CSET.Width = 150
CSET.Key = "YourCaptionKey"
' FOLLOWING LINE THROW ERROR
**CSET.Add(New Janus.Windows.GridEX.GridEXColumn(dgMulti.RootTable.Columns(0).Key, dgMulti.RootTable.Columns(0).ColumnType), 0, 1)
CSET.Add(New Janus.Windows.GridEX.GridEXColumn(dgMulti.RootTable.Columns(1).Key, dgMulti.RootTable.Columns(1).ColumnType), 0, 2)**
dgMulti.RootTable.ColumnSets.Add(CSET)
dgMulti.RootTable.ColumnSetHeaderLines = 2
dgMulti.RootTable.CellLayoutMode = Janus.Windows.GridEX.CellLayoutMode.UseColumnSets
Error: Operation is not valid due to the current state of the object.
Can you please help what I am missing? I believe I need to somehow link the columns with ColumnSets but how?
You don't need columnsets for this.
I can't get a deeplink to the janus forums thread with this answer, but here is the copy/pasted answer:
You can put a CR Character if you can determine where to wrap.
in e.g.
Column.Caption = Now.ToString("ddd" & vbCr & "d MMM");
You can see the janus support forums here: https://www.janusys.com. Click through to the Winforms GridEX forum, and use search phrase "wrap".
The website is basically unusable in Firefox, I fallback to Chrome to browse.
Dim CSET As New Janus.Windows.GridEX.GridEXColumnSet()
CSET.Caption = "YourCaption"
CSET.HeaderAlignment = Janus.Windows.GridEX.TextAlignment.Center
CSET.ColumnCount = 2
CSET.Width = 150
CSET.Key = "YourCaptionKey"
dgMulti.RootTable.ColumnSets.Add(CSET)
CSET.Add(dgMulti.RootTable.Columns.Add("Yourcolumnkey"), 0, 0)
CSET.Add(dgMulti.RootTable.Columns.Add("Yourcolumnkey"), 0, 1)
dgMulti.RootTable.ColumnSetHeaderLines = 2
dgMulti.RootTable.CellLayoutMode = Janus.Windows.GridEX.CellLayoutMode.UseColumnSets

dnn 7+ search is not indexing custom module items

I have a dnn 7.2.2 development site running under dnndev.me on my local machine. I have created a simple product catalogue module and am trying to integrate the new search for dnn 7.
Here is the implementation of ModuleSearchBase in my feature/business controller
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Search
Imports DotNetNuke.Common.Globals
Namespace Components
Public Class FeatureController
Inherits ModuleSearchBase
Implements IUpgradeable
Public Overrides Function GetModifiedSearchDocuments(moduleInfo As ModuleInfo, beginDate As Date) As IList(Of Entities.SearchDocument)
Try
Dim SearchDocuments As New List(Of Entities.SearchDocument)
'get list of changed products
Dim vc As New ViewsController
Dim pList As List(Of vw_ProductList_Short_Active) = vc.GetProduct_Short_Active(moduleInfo.PortalID)
If pList IsNot Nothing Then
''for each product, create a searchdocument
For Each p As vw_ProductList_Short_Active In pList
Dim SearchDoc As New Entities.SearchDocument
Dim ModID As Integer = 0
If p.ModuleId Is Nothing OrElse p.ModuleId = 0 Then
ModID = moduleInfo.ModuleID
Else
ModID = p.ModuleId
End If
Dim array() As String = {"mid=" + ModID.ToString, "id=" + p.ProductId.ToString, "item=" + Replace(p.Name, " ", "-")}
Dim DetailUrl = NavigateURL(moduleInfo.TabID, GetPortalSettings(), "Detail", array)
With SearchDoc
.AuthorUserId = p.CreatedByUserId
.Body = p.ShortInfo
.Description = p.LongInfo
.IsActive = True
.PortalId = moduleInfo.PortalID
.ModifiedTimeUtc = p.LastUpdatedDate
.Title = p.Name + " - " + p.ProductNumber
.UniqueKey = Guid.NewGuid().ToString()
.Url = DetailUrl
.SearchTypeId = 2
.ModuleId = p.ModuleId
End With
SearchDocuments.Add(SearchDoc)
Next
Return SearchDocuments
Else
Return Nothing
End If
Catch ex As Exception
LogException(ex)
Return Nothing
End Try
End Function
End Class
End Namespace
I cleared the site cache and then I manually started a search re-index. I can see from the host schedule history that the re-index is run and completes.
PROBLEM
None of the items in the above code are added to the index. I even used the Luke Inspector to look into the lucene index and that confirms that these items are not added.
QUESTION
I need help figuring out why these items are not getting added or I need help on how to debug the indexing to see if anything is going run during that process.
Thanks in Advance
JK
EDIT #1
I ran the following procedure in Sql Server to see if the module is even listed in the search modules:
exec GetSearchModules[PortalId]
The module in question does appear in this list. The indexing is called for the featureController, but the results are not added to the lucene index. Still need help.
EDIT #2
So I upgraded to 7.3.1 in the hopes that something during the installation would fix this issue. But it did not. The search documents are still getting created/ returned by the GetModifiedSearchDocuments function but the documents are not being added to the Lucene index and therefore do not appear in the search results.
EDIT #3
The break point is not getting hit like i thought after the upgrade, but I added a try catch to log exceptions and the following error log is getting created when I try to manually re-index (cleaned up to keep it short)
AssemblyVersion:7.3.1
PortalID:-1
PortalName:
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:d0a443da-3d68-4b82-afb3-8c9183cf8424
InnerException:Sequence contains more than one matching element
Method:System.Linq.Enumerable.Single
StackTrace:
Message:
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.LoadQueueFromTimer()
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.Start()
Source:
Server Name: KING-PC
EDIT #4
Okay, I fixed the problem in edit three following This Disucssion on the DNN issue tracker, but still no items being added to the lucene index.
The breakpoint is hit, and once i leave the debugger running for a while i get the following error:
{"Exception of type 'Lucene.Net.Index.MergePolicy+MergeException' was
thrown."} {"Cannot overwrite:
C:\websites\dnndev.me\App_Data\Search\_1f0.fdt"}
Looks like a permission error. I'll see what I can work out
J King,
I just finished a series on DNNHero.com on Implementing Search in your Module. Parts 3 and 4 are implementing and debugging your ModuleSearchBase implementation.
EDIT: Remove your assignment to the SearchTypeId in your implementation
Also, here is a sample snippet to see how i am setting the attributes of the SearchDocument. Again, watch my video for a whole bunch of other potential pitfalls in the Search implementation.
SearchDocument doc = new SearchDocument
{
UniqueKey = String.Format("{0}_{1}_{2}",
moduleInfo.ModuleDefinition.DefinitionName, moduleInfo.PortalID, item.ItemId),
AuthorUserId = item.AssignedUserId,
ModifiedTimeUtc = item.LastModifiedOnDate.ToUniversalTime(),
Title = item.ItemName,
Body = item.ItemDescription,
Url = "",
CultureCode = "en-US",
Description = "DotNetNuclear Search Content Item",
IsActive = true,
ModuleDefId = moduleInfo.ModuleDefID,
ModuleId = item.ModuleId,
PortalId = moduleInfo.PortalID,
TabId = tab
};

Lua script - Coding a scenario

Situation :
There are two sensors and I want to save the data of values of each sensor in the certain file..But it's not working. I am working on linux system and the file is still empty.
What's wrong with my code? any suggestion please?
my code is:
--Header file
require("TIMER")
require("TIMESTAMP")
require("ANALOG_IN")
function OnExit()
print("Exit code...do something")
end
function main()
timer = "TIMER"
local analogsensor_1 = "AIR_1"
local analogsensor_2 = "AIR_2"
local timestr = os.data("%Y-%m-%d %H:%M:%S")
-- open the file for writing binary data
local filehandle = io.open("collection_of_data.txt", "a")
while true do
valueOfSensor_1 = ANALOG_IN.readAnalogIn(analogsensor_1);
valueOfSensor_2 = ANALOG_IN.readAnalogIn(analogsensor_2);
if (valueOfSensor_1 > 0 and valueOfSensor_2 > 0) then
-- save values of sensors
filehandle:write(timestr, " -The Value of the Sensors: ", tostring(valueOfSensor_1), tostring(valueOfSensor_2)"\n");
end
TIMER.sleep(timer,500)
end
-- close the file
filehandle:close()
end
print("start main")
main()
I do not know what this libs realy do.
But this code is incorrect;
1) you do not close while statement.
if in real code you close it before filehandle:close() then try call filehandle:flush()
2) you forgot comma:
filehandle:write(timestr, " -The Value of the Sensors: ", tostring(valueOfSensor_1), tostring(valueOfSensor_2)"\n")
(it should seay something like attemt call a number value).
3) try print out valueOfSensor_1 and valueOfSensor_2 values. May be there no data.
Beside the typos pointed out by #moteus, shouldn't this:
if (valueOfSensor_1 and valueOfSensor_2 > 0) then
be like this?
if (valueOfSensor_1 > 0 and valueOfSensor_2 > 0) then
Edit, in response to your comment to another answer:
still error..it says "attempt to call field 'data' (a nil value)
I can't be sure without the stack trace, but, most likely, something bad happens in the ANALOG_IN library code. You may not be using it properly.
try to turn this:
valueOfSensor_1 = ANALOG_IN.readAnalogIn(analogsensor_1);
valueOfSensor_2 = ANALOG_IN.readAnalogIn(analogsensor_2);
into this:
success, valueOfSensor_1 = pcall(ANALOG_IN.readAnalogIn, analogsensor_1);
if not success then
print("Warning: error reading the value of sensor 1:\n"..valueOfSensor_1)
valueOfSensor_1 = 0
end
success, valueOfSensor_2 = pcall(ANALOG_IN.readAnalogIn, analogsensor_2);
if not success then
print("Warning: error reading the value of sensor 2:\n"..valueOfSensor_2)
valueOfSensor_2 = 0
end
If the failure in ANALOG_IN is not systematic, it will work around it. If the call fails systematically, you'll get a huge warning log, and an empty collection_of_data.txt.
Please note that ANALOG_IN is not a standard Lua library. You should check its documentation , and pay attention to the details of its usage.

VB.Net Image is not Showing at Runtime

Button image and icon is not showing at runtime
Button Image
Me.wibtnAdd.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.wibtnAdd.DisabledImagesGrayScale = False
Me.wibtnAdd.Enabled = False
Me.wibtnAdd.Image = CType(resources.GetObject("wibtnAdd.Image"), System.Drawing.Image)
Me.wibtnAdd.ImageFixedSize = New System.Drawing.Size(24, 24)
Me.wibtnAdd.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top
Me.wibtnAdd.Location = New System.Drawing.Point(53, 302)
Me.wibtnAdd.Name = "wibtnAdd"
Me.wibtnAdd.Shape = New DevComponents.DotNetBar.RoundRectangleShapeDescriptor(2)
Me.wibtnAdd.Size = New System.Drawing.Size(61, 52)
Me.wibtnAdd.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.wibtnAdd.TabIndex = 8
Me.wibtnAdd.Text = "Add"
Form Icon
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
to make your code more clear : 1) get rid of the 'Me'
2) use a 'With' clause
(i edited)
the issue seems to be in your access to resources : are you sure
you have a resource named "wibtnAdd.Image" ? it seems 'strange'
that it has same name as your object/property... Check your
wibtnAdd.Image, it might be Nothing. Same for your Icon.
Btw why not doing this in xaml ?? it would be much more readable,
and you can edit everything while seeing results.

How to get an outline view in sublime texteditor?

How do I get an outline view in sublime text editor for Windows?
The minimap is helpful but I miss a traditional outline (a klickable list of all the functions in my code in the order they appear for quick navigation and orientation)
Maybe there is a plugin, addon or similar? It would also be nice if you can shortly name which steps are neccesary to make it work.
There is a duplicate of this question on the sublime text forums.
Hit CTRL+R, or CMD+R for Mac, for the function list. This works in Sublime Text 1.3 or above.
A plugin named Outline is available in package control, try it!
https://packagecontrol.io/packages/Outline
Note: it does not work in multi rows/columns mode.
For multiple rows/columns work use this fork:
https://github.com/vlad-wonderkidstudio/SublimeOutline
I use the fold all action. It will minimize everything to the declaration, I can see all the methods/functions, and then expand the one I'm interested in.
I briefly look at SublimeText 3 api and view.find_by_selector(selector) seems to be able to return a list of regions.
So I guess that a plugin that would display the outline/structure of your file is possible.
A plugin that would display something like this:
Note: the function name display plugin could be used as an inspiration to extract the class/methods names or ClassHierarchy to extract the outline structure
If you want to be able to printout or save the outline the ctr / command + r is not very useful.
One can do a simple find all on the following grep ^[^\n]*function[^{]+{ or some variant of it to suit the language and situation you are working in.
Once you do the find all you can copy and paste the result to a new document and depending on the number of functions should not take long to tidy up.
The answer is far from perfect, particularly for cases when the comments have the word function (or it's equivalent) in them, but I do think it's a helpful answer.
With a very quick edit this is the result I got on what I'm working on now.
PathMaker.prototype.start = PathMaker.prototype.initiate = function(point){};
PathMaker.prototype.path = function(thePath){};
PathMaker.prototype.add = function(point){};
PathMaker.prototype.addPath = function(path){};
PathMaker.prototype.go = function(distance, angle){};
PathMaker.prototype.goE = function(distance, angle){};
PathMaker.prototype.turn = function(angle, distance){};
PathMaker.prototype.continue = function(distance, a){};
PathMaker.prototype.curve = function(angle, radiusX, radiusY){};
PathMaker.prototype.up = PathMaker.prototype.north = function(distance){};
PathMaker.prototype.down = PathMaker.prototype.south = function(distance){};
PathMaker.prototype.east = function(distance){};
PathMaker.prototype.west = function(distance){};
PathMaker.prototype.getAngle = function(point){};
PathMaker.prototype.toBezierPoints = function(PathMakerPoints, toSource){};
PathMaker.prototype.extremities = function(points){};
PathMaker.prototype.bounds = function(path){};
PathMaker.prototype.tangent = function(t, points){};
PathMaker.prototype.roundErrors = function(n, acurracy){};
PathMaker.prototype.bezierTangent = function(path, t){};
PathMaker.prototype.splitBezier = function(points, t){};
PathMaker.prototype.arc = function(start, end){};
PathMaker.prototype.getKappa = function(angle, start){};
PathMaker.prototype.circle = function(radius, start, end, x, y, reverse){};
PathMaker.prototype.ellipse = function(radiusX, radiusY, start, end, x, y , reverse/*, anchorPoint, reverse*/ ){};
PathMaker.prototype.rotateArc = function(path /*array*/ , angle){};
PathMaker.prototype.rotatePoint = function(point, origin, r){};
PathMaker.prototype.roundErrors = function(n, acurracy){};
PathMaker.prototype.rotate = function(path /*object or array*/ , R){};
PathMaker.prototype.moveTo = function(path /*object or array*/ , x, y){};
PathMaker.prototype.scale = function(path, x, y /* number X scale i.e. 1.2 for 120% */ ){};
PathMaker.prototype.reverse = function(path){};
PathMaker.prototype.pathItemPath = function(pathItem, toSource){};
PathMaker.prototype.merge = function(path){};
PathMaker.prototype.draw = function(item, properties){};