❔ Add textbox.text from Form1 to another class

Hi, i want to add textbox9.text from Form1 to the filename that is in another class. Ive made it public, but it doesnt work. Thanks
8 Replies
Buddy
Buddy2y ago
$details
MODiX
MODiX2y ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Buddy
Buddy2y ago
Also, nobody is going to download a rar file just to help. Please paste the important snippets to the site linked above and add way more context regarding your issue.
TheFjallraven
TheFjallravenOP2y ago
public System.Windows.Forms.TextBox textBox9; Object newFileName = Path.Combine(_fileInfo.DirectoryName, "docs", _fileInfo.Name + DateTime.Now.ToString("ddMMyy")); the textbox9 seems to be public namespace BlankiDoc___Lekari { class WordHelper {
private FileInfo _fileInfo;
public WordHelper(string fileName) {
if (File.Exists(fileName)) { _fileInfo = new FileInfo(fileName); } else { throw new ArgumentException("File not found"); } }
internal bool Process(Dictionary<string, string> items) { Word.Application app = null; try { app = new Word.Application(); Object file = _fileInfo.FullName;
Object missing = Type.Missing;
app.Documents.Open(file); foreach (var item in items) { Word.Find find = app.Selection.Find; find.Text = item.Key; find.Replacement.Text = item.Value; Object wrap = Word.WdFindWrap.wdFindContinue; Object replace = Word.WdReplace.wdReplaceAll; find.Execute(FindText: Type.Missing, MatchCase: false, MatchWholeWord: false, MatchWildcards: false, MatchSoundsLike: missing, MatchAllWordForms: false, Forward: true, Wrap: wrap, Format: false, ReplaceWith: missing, Replace: replace);
} Object newFileName = Path.Combine(_fileInfo.DirectoryName, "docs", _fileInfo.Name + DateTime.Now.ToString("ddMMyy")); app.ActiveDocument.SaveAs2(newFileName); app.ActiveDocument.Close(); MessageBox.Show("Документът : " + newFileName + " е успешно създаден.");

return true; } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (app != null) { app.Quit(); } } return false;

} } }
tfs
tfs2y ago
share code through this https://paste.mod.gg/
BlazeBin
A tool for sharing your source code with the world!
TheFjallraven
TheFjallravenOP2y ago
TheFjallraven
TheFjallravenOP2y ago
BlazeBin - yxoohugpkmez
A tool for sharing your source code with the world!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server